Solved

Replacing Characters within a TTY Printer Driver (W2003)

Posted on 2004-03-29
4
363 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
[X]
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
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

751 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