how to call outp (conio.h)

I get a
LNK2001 unresolved external symbol _outp
link error on the following code:

#include "conio.h"

int main (void)
  outp(0x64, 0xFE); //reboot Win95
  return 0;

Can somebody help me to get this code running?
I am trying to reproduce assembler
OUT 0x64, 0xFE
code to perform a Win95 reboot.
Who is Participating?
modderConnect With a Mentor Commented:
As you found your own solution, I'll refund your points, and I'll make this a PAQ

Community Support Moderator@Experts-Exchange
Why don't you use

ExitWindowsEx ( EXW_REBOOT, NULL);

Basically, you cannot call the outp instruction from a WIN32 user-mode application.  It's a protected instruction and can only be executed from the privileged instruction level.

jkr has the correct suggestion to reboot Windows from a WIN32 app.  If you really need to do outp, you need a VxD or static device driver or you need to "thunk" to 16-bit mode.
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

saracogluAuthor Commented:
I need to reboot win95 on an almost crashed situation. The ExitWindowsEx API does not work then.
Somebody has compiled me a VC dll to call from VB. It works perfect.
He sent me only this code piece, and said, that was it.
Now he is on holiday, and I need to reproduce this code.
You may have to compile and link the code for 16 bit DOS mode (target = Dos executable, /not/ win32 console)
saracogluAuthor Commented:
I have found it.
I needed to put an underscore before outp (like: _outp)

thanks for the ideas.
The code is now working as follows:

#define DllExport __declspec( dllexport )

#include <conio.h>

extern "C" DllExport long Reboot9x()
 int Dummy;
 Dummy = _outp(0x64, 0xFE);
 return 0;

I will contact ee to move this question to paq

Actually, you can do ins and outs in Win32, at least from Win95. It is expensive, because when the priviledged instruction is trapped by the operating system, Win95 (at least) reproduces the in or out in ring0 before returning to the ring3 code. Moral is you can do it, but it is ***slow***.

- jack
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.