Solved

Replacing Characters within a TTY Printer Driver (W2003)

Posted on 2004-03-29
4
360 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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 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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

772 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