How can I capture the program's arguments for a HP printer manager software?

  • Thread starter Thread starter kandelabr
  • Start date Start date
  • Tags Tags
    Capture
Click For Summary

Discussion Overview

The discussion revolves around capturing command-line arguments for an HP printer manager software that calls another program to send print jobs. Participants explore methods to identify how the printer name is passed to this secondary program, given the lack of documentation and source code.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes the challenge of running a secondary program that requires a device specification, suggesting that a command-line argument is missing.
  • Another participant proposes debugging the program to find the command-line arguments by looking for a call to a WinAPI function that starts a process, specifically mentioning the CreateProcess function.
  • A different approach is suggested where a new program is created to capture and print the arguments passed to the original program, allowing the user to see what arguments are being used.
  • Several participants express enthusiasm for the proposed solution of creating a wrapper program to capture arguments, with one participant sharing a sample code snippet for implementation.
  • One participant indicates they were able to implement the solution independently, expressing gratitude for the suggestions received.

Areas of Agreement / Disagreement

Participants generally agree on the need to capture command-line arguments and explore various methods to achieve this. However, there are no settled conclusions on the best approach, and multiple strategies are discussed.

Contextual Notes

Some participants mention potential legal or ethical considerations regarding debugging the software, which may depend on agreements with HP. Additionally, there are references to specific programming techniques and tools that may not be universally accessible or understood.

Who May Find This Useful

This discussion may be useful for software developers, programmers interested in debugging techniques, and users of HP printer management software seeking to understand command-line operations.

kandelabr
Messages
110
Reaction score
0
Hi,

I have a program (it's HP printer manager software) that calls another program to send something to the printer. I found that program, but it can't run alone -- it says "device was not specified".

I am positive there is just some kind of command-line argument missing, but there exists no documentation, so I wonder if there is a way to figure out how printer name is passed to that program. Of course, no source code exists.

Also, in Windows 7 I could create a shortcut to that program (button, actually), but it points to a control panel item (I couldn't make this shortcut in Win XP), and opening this .lnk only throws out a pile of junk (see below).

Code:
LŔF1phî&
*×D“qľ°dɆƒ„!Ţ9qXf©¨}:$DŤ$á€i\zGA™gE3á1SPS˘pˆ‚`¬GŠ«§9ŃŁĂĹYProvider\Microsoft.Base.DeviceDisplayObjects//DDO:{1C852A4D-B800-1F08-ABCD-2C768AB16674}u1SPS0ń·ďGĄń`Śžë¬Y
$HP Officejet 6500 E710n-z (Network)z1SPSł;jeŔěýC„wJŕ@J–Í HPE HP Officejet 6500 E710n-zU1SPSŔÔŤĐž:.F‚{ckvą9
Printers and Faxesä1SPSČOĂxJĘJž¤RMR™nW]ZPrintFax.PrinterImaging.ScannerM˙˙8I9›c:\users\nejc\appdata\local\microsoft\device metadata\dmrccache\en-us\980b8cac-9db5-4165-9da0-1c9e24cd76c7\DeviceInformation\HP Officejet 6500 E710n-z.ico91SPSŇ~ŚŠ?'Hł«®ž®ülHM*…¸«Í,vбftí1SPS¦jc(=•ҵÖŔOŮĐŃ_Provider

Any ideas?

Thanks.
 
Technology news on Phys.org
You could debug it, but that may violate some agreements you made with HP by installing the software (or setting up your computer, if it came preinstalled).

To debug it, look for a call to some WinAPI function that starts a process. It will pass a pointer to the function. Find that string; it will contain the arguments.

EDIT: Look for a call to this function: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx.

You can look for a call in Olly Debug 2 by right clicking the code window and going to Go to->Expression and typing "CreateProcess."
 
Last edited:
kandelabr said:
Hi,

I have a program (it's HP printer manager software) that calls another program to send something to the printer. I found that program, but it can't run alone -- it says "device was not specified".

I am positive there is just some kind of command-line argument missing, but there exists no documentation, so I wonder if there is a way to figure out how printer name is passed to that program. Of course, no source code exists.

Also, in Windows 7 I could create a shortcut to that program (button, actually), but it points to a control panel item (I couldn't make this shortcut in Win XP), and opening this .lnk only throws out a pile of junk (see below).

Any ideas?

Thanks.

Try this.

if the program's name is a a.exe, then rename it as aold.exe.

Write a new program a.exe does the following things
1) Prints out the arguments passed to it in a file
2) Call the original program with the same arguments

Open the file in a text editor & you will see the arguments.
 
phiby said:
Try this.

if the program's name is a a.exe, then rename it as aold.exe.

Write a new program a.exe does the following things
1) Prints out the arguments passed to it in a file
2) Call the original program with the same arguments

Open the file in a text editor & you will see the arguments.

Haha! I like that. I should have thought of that.
 
The IDEA!

Thanks men, you just made my day.

Thanks to Tyler too, but I'm not that into computing, yesterday I nearly got killed by VC++ :)

A computer shall never win against me (or PF)! .
 
kandelabr said:
The IDEA!

Thanks men, you just made my day.

Thanks to Tyler too, but I'm not that into computing, yesterday I nearly got killed by VC++ :)

A computer shall never win against me (or PF)! .


If you want the code for the program I suggested - here

Code:
#include <iostream>
#include <fstream>

using std::ofstream;
int main(int argc, char **argv)
{
        ofstream of("c:/tmp/tst"); // Change this to whatever path you want the
                                            // file to be written to
        while(argc--)
                of<<*argv++<<' ';

        of<<'\n';
}
 
Yeah, I was able to do that by myself.
Thanks anyway.