• C

Error: Acess Violation.... Reading address 0x408

I need to read the address 0x00000408 for the port address of LPT1. Everytime I try to access that memory in Win95 using pointer, the error prompt out and crashed my system.

How can I access the memory that does not belong to my program?

Thanks.
skidzAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
plsbctvConnect With a Mentor Commented:
I'm having to make some guesses here. You're writing a WIN32 application that wants to print to a default printer. You can't read the BIOS memory location that contains the BIOS printer port address because of memory protection. Even if you had this address, you couldn't use it from an application.

Let's call this an answer. Depending on what you want to do, your answer is one of these things.

1. If you want to print a document, you use Windows GDI functions along with the StartDoc API function. The documentation for this can be found at http://premium.microsoft.com/msdn/library/sdkdoc/gdi/pantdraw_3wtj.htm and the following pages. This assumes your printer has an appropriate WIndows driver installed.

2. If you want to talk to the printer directly, use the Windows API function ReadPrinter and WritePrinter. This documentation is at http://premium.microsoft.com/msdn/library/sdkdoc/gdi/prntspol_62ia.htm and following. Again, this assumes your printer has a driver installed. There's more information in Microsoft Knowledge Base article Q196805.

3. If you want to use the printer port to talk to a device that isn't a printer and there is no print driver installed for that port, then you can talk to the port by using the Windows API function

   handle = CreateFile(
      "\\\\.\\LPT1",     // address of name of the communications device
      fdwAccess,          // access (read-write) mode
      0,                  // share mode
      NULL,               // address of security descriptor
      OPEN_EXISTING,      // how to create
      0,                  // file attributes
      NULL                // handle of file with attributes to copy   );

The use handle with ReadFIle and WriteFile calls. Any good WIndows programming book will have this information.
have
0
 
heyhey_Commented:
post the code that crashes your system
0
 
jkrCommented:
heyhey - no source code necessary ;-)

You simply CANNOT read (or write) from (to) physical memory addresses under Win32, unless you don't do it in a VXD ...
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
heyhey_Commented:
jkr:
what about old DOS programs ? also, as far as i remember, some guy succeeded to clear the interrupt table (on WIn95 - it does not works on WInNT) - (ok i may be wrong ;-)

probably "crashed my system" means just classic GPF or ??

0
 
jkrCommented:
Well, i wouldn't rely on this... and even if it works, how should he pass the result to a Win32 app?
0
 
skidzAuthor Commented:
So??? Anyone have the idea to read address 0x408 in Win95?

0
 
AlexVirochovskyCommented:
As JKR write, you can't make in in Windows95 and must write
VXD driver (see Windows Doc or www.vireo.com)
0
 
PacmanCommented:
skidz,

use the following VXD-Driver (shareware) to direct-access physical memory from Windows  NT / Windows 95/98, etc.

TVicHW32 3.00

You find it at
http://www.entechtaiwan.com/tools.htm

I've tried it already and it works

regards
Pacman
0
 
skidzAuthor Commented:
I'm writing a software that need to access the memory address. Anyone cangive me the code to access that memory? I don't want any shareware/freeware product.
0
 
heyhey_Commented:
skidz:
1.) what languale / library you use ?
2.) do you really need access to memory or just the status of LPT1 ?
3.) explain better your problem ? probably post the code that doesn't work for you ...
0
 
plsbctvCommented:
> How can I access the memory that does not belong to my program?

In a Windows 95 application, you can't. Period. And even if you could read that memory location and get the port address you couldn't do anything use with the port either.

Please step back and tell us what you're trying to accomplish. There is probably another way.
0
 
skidzAuthor Commented:
I would like to setup an auto configuration for my LPT port. B'coz the base address of the LPT1 is at 0x408. So ... I just wanna read the memory... please help.

0
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.