Solved

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

Posted on 1998-11-27
12
588 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_
Comment Utility
post the code that crashes your system
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
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_
Comment Utility
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
 
LVL 86

Expert Comment

by:jkr
Comment Utility
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
Comment Utility
So??? Anyone have the idea to read address 0x408 in Win95?

0
 
LVL 14

Expert Comment

by:AlexVirochovsky
Comment Utility
As JKR write, you can't make in in Windows95 and must write
VXD driver (see Windows Doc or www.vireo.com)
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 9

Expert Comment

by:Pacman
Comment Utility
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
Comment Utility
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_
Comment Utility
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
Comment Utility
> 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now