Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Replacing Characters within a TTY Printer Driver (W2003)

Posted on 2004-03-29
4
361 Views
Last Modified: 2011-09-21
This is my first question here, and I'm not a C++ guy, but I've been asked to find a way to swap some characters out in a simple TTY printer driver.  The idea is to replace some weird control codes coming from one application before they get to the printer and mess up the output.

For this problem, I'd be happy to have the capability to switch "The quick brown fox" to "The slow brown fox" inside the standard TTY driver, for example -- in other words, to always find and switch "slow" for "quick".  In the real application, of course, it's more a string of relatively meaningless control characters.

I've been trying to modify the oemcom.cpp generic text driver provided with the Windows DDK, but I'm getting nowhere.

I tried modifying OutputCharStr in oemcom.cpp, for example:

      // Hello World??
      char* HelloWorld = "Hello World";
      pMyStuff->aubSpoolBuf = (PBYTE) &HelloWorld;

and it at least doesn't crash, but just gives me funky characters before and after the main text is printed - presumably related to header and footer information for the document.

It seems like there ought to be a string somewhere that could be modified as required, but I'm not finding it.

Thanks for any help.

Curt LaMontagne
0
Comment
Question by:Clamont
4 Comments
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 250 total points
ID: 10712789
There are two things you can do on your machine:
- re-implment the printer driver and do the string manipulations in the driver.
- implment a new port monitor for your output device (I assume you are printing via the serial port) that does the string manipulation.

The difference between the two is that the first one actually modifies the data that the driver produces, and you can use this with any port monitor, whereas the second one modifies teh behavior of the port monitor, so it will work with any printer driver.

The third solution would be (that is, if this is really a serial printer) to add another (cheap) computer between your machine and the printer that filters the serial data. Because the serial communication is really slow, you can take the oldest computer you can get your hands on for this task.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

829 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