The following code is not working.it gives the same error messege as it gives when program specified for win95/98 is run. - #include <stdio.h>
-
#include <conio.h>
-
#include <windows.h>
-
#include <string.h>
-
#include <io.h>
-
#include <stdafx.h>
-
#include <windows.h>
-
#include <windowsx.h>
-
#include <oleauto.h>
-
#include "stdafx.h"
-
#include "stdio.h"
-
#include "string.h"
-
#include "stdlib.h"
-
-
-
// C RunTime Header Files
-
-
#include <malloc.h>
-
#include <memory.h>
-
#include <tchar.h>
-
-
-
-
/* Definitions in the build of inpout32.dll are: */
-
/* short _stdcall Inp32(short PortAddress); */
-
/* void _stdcall Out32(short PortAddress, short data); */
-
-
/* prototype (function typedef) for DLL function Inp32: */
-
-
typedef short (_stdcall *inpfuncPtr)(short portaddr);
-
typedef void (_stdcall *oupfuncPtr)(short portaddr, short datum);
-
-
#define PPORT_BASE 0x378
-
-
-
// Prototypes for Test functions
-
void test_read8(void);
-
void test_write(void);
-
void test_write_datum(short datum);
-
-
-
/* After successful initialization, these 2 variables
-
will contain function pointers.
-
*/
-
inpfuncPtr inp32fp;
-
oupfuncPtr oup32fp;
-
-
-
/* Wrapper functions for the function pointers
-
- call these functions to perform I/O.
-
*/
-
short Inp32 (short portaddr)
-
{
-
return (inp32fp)(portaddr);
-
}
-
-
void Out32 (short portaddr, short datum)
-
{
-
(oup32fp)(portaddr,datum);
-
}
-
-
-
int main(void)
-
{
-
HINSTANCE hLib;
-
-
-
-
/* Load the library */
-
hLib = LoadLibrary(TEXT("inpout32.dll"));
-
-
if (hLib == NULL) {
-
fprintf(stderr,"LoadLibrary Failed.\n");
-
return -1;
-
}
-
-
/* get the address of the function */
-
-
inp32fp = (inpfuncPtr) GetProcAddress(hLib, "Inp32");
-
-
if (inp32fp == NULL) {
-
fprintf(stderr,"GetProcAddress for Inp32 Failed.\n");
-
return -1;
-
}
-
-
-
oup32fp = (oupfuncPtr) GetProcAddress(hLib, "Out32");
-
-
if (oup32fp == NULL) {
-
fprintf(stderr,"GetProcAddress for Oup32 Failed.\n");
-
return -1;
-
}
-
-
-
/*******************************************************/
-
/** IF WE REACHED HERE, INITIALIZED SUCCESSFUL ******/
-
/*******************************************************/
-
-
/* now test the functions */
-
-
-
/***** Read 8 bytes at I/O base address */
-
test_read8();
-
-
-
/***** Write 0x75 to data register and verify */
-
test_write();
-
-
-
-
/***** One more time, different value */
-
test_write_datum(0xAA);
-
-
-
/* finished - unload library and exit */
-
FreeLibrary(hLib);
-
return 0;
-
}
-
-
/*
-
TEST: Read inputs of 8 registers from PORT_BASE address
-
*/
-
void test_read8(void) {
-
-
short x;
-
int i;
-
-
/* Try to read 0x378..0x37F, LPT1: */
-
-
for (i=PPORT_BASE; (i<(PPORT_BASE+8)); i++) {
-
-
x = Inp32(i);
-
-
printf("Port read (%04X)= %04X\n",i,x);
-
}
-
-
}
-
-
/*
-
TEST: Write constant 0x77 to PORT_BASE (Data register)
-
*/
-
void test_write(void) {
-
short x;
-
int i;
-
-
/***** Write the data register */
-
-
i=PPORT_BASE;
-
x=0x75;
-
-
/***** Write the data register */
-
Out32(i,x);
-
-
printf("Port write to 0x%X, datum=0x%2X\n" ,i ,x);
-
-
/***** And read back to verify */
-
x = Inp32(i);
-
printf("Port read (%04X)= %04X\n",i,x);
-
-
-
/***** Set all bits high */
-
x=0xFF;
-
Out32(i,x);
-
-
/***** Now, set bi-directional and read again */
-
Out32(PPORT_BASE+2,0x20); // Activate bi-directional
-
x = Inp32(i);
-
printf("Set Input, read (%04X)= %04X\n",i,x);
-
-
Out32(PPORT_BASE+2,0x00); // Set Output-only again
-
x = Inp32(i);
-
printf("Reset Ouput, read (%04X)= %04X\n",i,x);
-
-
-
}
-
-
/*
-
TEST: Write data from parameter
-
*/
-
void test_write_datum(short datum) {
-
short x;
-
int i;
-
-
i=PPORT_BASE;
-
x = datum;
-
-
/***** Write the data register */
-
Out32(i,x);
-
-
printf("Port write to 0x%X, datum=0x%2X\n" ,i ,x);
-
-
/***** And read back to verify */
-
x = Inp32(i);
-
printf("Port read (%04X)= %04X\n",i,x);
-
}
1 2138
The following code is not working.it gives the same error messege as it gives when program specified for win95/98 is run.
Too bad; sadly enough we're not all psychic so could you please elaborate a bit
on *what* the error is exactly? And *what* did you expect it to do? Please help
us to help you.
kind regards,
Jos
ps. I also changed your topic title ("hi" was not a very informative title)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Yogesh Khanolkar |
last post by:
Hi,
I am getting incorrect o/p from the code below:
#include<stdio.h>
#include<float.h>
#include<limits.h>
main()
{
double val,val1;
|
by: Linda Wienholt |
last post by:
I have two usercontrols on the home page of my website. They are intermitently sending incorrect HTML to the browser, which results in a textbox being rendered with the wrong width. Either both...
|
by: murphy |
last post by:
Hi,
I've been seeing two symptoms with my asp.net site that have started
recently after a long period of smooth running. As others on our team
make changes to referenced dll's I find that I get...
|
by: murphy |
last post by:
Hi,
I've been seeing two symptoms with my asp.net site that have started
recently after a long period of smooth running. As others on our team
make changes to referenced dll's I find that I...
|
by: Peter Ritchie |
last post by:
Does anyone know how to suppress a specific warning for a line or block of
code in C#? C++ has a nice facility to disable a warning for a block of code
with #pragma for warnings that are incorrect...
|
by: mankolele |
last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Simple Database Connection</title>
</head>
<body bgcolor="white">
<?php
$connection =...
|
by: roamnet |
last post by:
hi
i created database file with .mdf extention ,sql server as a source
and use grid view to display data
there're no problem in data retrieve and display,but i want to edit it
or insert new...
|
by: arial |
last post by:
Hi,
I am getting this error message:
Incorrect syntax near the keyword 'where'.
Description: An unhandled exception occurred during the execution of the current web request. Please review...
|
by: lee123 |
last post by:
I have a problem getting the correct to count +1 every time I get an answer right
and the incorrect is the same.
I have two lbl's named number1 and number2 which produces a Rnd# in each lbl.
...
|
by: zandrew |
last post by:
Hello there everyone. For a summer project I'm doing, I have to use a phone to pass an image I've taken (on the phone) to a dedicated server I've made on a local ubuntu machine. For the upload code,...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |