Solved

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

Posted on 1998-11-27
12
592 Views
Last Modified: 2012-05-04
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.
0
Comment
Question by:skidz
  • 3
  • 3
  • 2
  • +3
12 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 1254689
post the code that crashes your system
0
 
LVL 86

Expert Comment

by:jkr
ID: 1254690
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 1254691
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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 86

Expert Comment

by:jkr
ID: 1254692
Well, i wouldn't rely on this... and even if it works, how should he pass the result to a Win32 app?
0
 

Author Comment

by:skidz
ID: 1254693
So??? Anyone have the idea to read address 0x408 in Win95?

0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1254694
As JKR write, you can't make in in Windows95 and must write
VXD driver (see Windows Doc or www.vireo.com)
0
 
LVL 9

Expert Comment

by:Pacman
ID: 1254695
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
 

Author Comment

by:skidz
ID: 1254696
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 1254697
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
 

Expert Comment

by:plsbctv
ID: 1254698
> 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
 

Author Comment

by:skidz
ID: 1254699
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
 

Accepted Solution

by:
plsbctv earned 50 total points
ID: 1254700
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

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question