Solved

Replacing Characters within a TTY Printer Driver (W2003)

Posted on 2004-03-29
4
352 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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

762 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

5 Experts available now in Live!

Get 1:1 Help Now