Solved

Plink beeps

Posted on 2010-09-23
12
830 Views
Last Modified: 2012-06-22
Hi Folks, this is driving me bananas..

I'm trying to find the bit of code within the PLINK source code that makes the terminal beep. Its turning out to be surprisingly hard to find. The whole thing is multithreaded so you can't just step thru until you hear the beep. With the full PUTTY compile, there's UI options to turn beep on and off, and the code relating to the settings is visible in the plink and putty projects, but I can't for the life of me find where the line of code is that actually does the beep.

I'm compiling for windows 2003 under C++ VS 2005

I'm guessing its probably an escape sequence sent to stdout to do a beep, as I can't see any win api beep calls in there ? But finding it is clearly way beyond my capability !

Source code is here http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Any ideas what I should be searching for ? or can you find it for me ????

thanks
0
Comment
Question by:plq
[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
  • 7
  • 5
12 Comments
 
LVL 31

Expert Comment

by:Zoppo
ID: 33742011
Hi plg,

I'm not really sure (since I didn't compile the code and test it) but I guess the code is in 'Terminal.c' in function 'static void term_out(Terminal *term)' near line 2754 starting with this line:

> case '\007':          /* BEL: Bell */

The '\007' indicates the ASCII code BEL (bell).

Hope that helps,

ZOPPO
0
 
LVL 8

Author Comment

by:plq
ID: 33742100
Hmmm. Interesting.

terminal.c isn't in the plink.vcproj project, which compiles and runs fine, and does do beeps.

however it is in the putty.vcproj project, which compiles and runs fine, but doesn't do beeps even when I tell it to in the UI  !!!!

Well you've given me a clue anyway..
0
 
LVL 8

Author Comment

by:plq
ID: 33742188
it seems to beep in a separate thread dedicated to terminal output, on line 280 of winhandl.c (WriteFile), the buffer contains the plink command prompt, and I guess an escape sequence which forms the beep is within that buffer...

Here's the mem dump of the buffer..

0x009BCFA4  61 6e 61 63 6f 6e 64 61 2d 6b 73 2e 63 66 67 20 20 73 64 0d 0a 1b 5d 30 3b 72 6f 6f 74 40 44 45 56 30 33 46 44 56 2d 46 45 44 4f 52 41 3a 7e 07 5b  anaconda-ks.cfg  sd...]0;root@DEV03FDV-FEDORA:~.[

0x009BCFD5  72 6f 6f 74 40 44 45 56 30 33 46 44 56 2d 46 45 44 4f 52 41 20 7e 5d 23 20 cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd  root@DEV03FDV-FEDORA ~]# ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ

0x009BD006  cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd  ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 31

Expert Comment

by:Zoppo
ID: 33742196
Hm - maybe it gets called via 'from_backend' (i.e. in 'Windows.c') which calls 'term_data' which calls 'term_out'.

But up to now I have no idea where the data comes from which is passed to 'from_backend' ...
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 33742230
Yes, this could be right - I guess the '07' in the first line is the 'BEL' char ...
0
 
LVL 8

Author Comment

by:plq
ID: 33742240
I'm there in debug mode, and its called direct from kernel32.dll, with no upstream callers shown. So its some kind of callback infrastructure where the kernel has received a function pointer to handle_output_threadfunc. The functions you list might allow me to catch where the beep gets put in though. Catching it in handle_output_threadfunc is a bit late I suppose. Let me do some messing around with the debugger...
0
 
LVL 8

Author Comment

by:plq
ID: 33742243
>>Yes, this could be right - I guess the '07' in the first line is the 'BEL' char ...
OK I can edit that out with the immediate window... will report back in a while
0
 
LVL 8

Author Comment

by:plq
ID: 33742266
Yay I made it a 32 instead of an 07, and it doesn't beep now ! thats pretty cool. An awful hack though. I'll report back later if I can find where that 07 originates from
0
 
LVL 8

Author Closing Comment

by:plq
ID: 33742570
A simple loop through the ctx->buffer to replace 7 with 32 did the job nicely.
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 33742617
Fine, that's great ...

Have a nice day,

best regards,

ZOPPO
0
 
LVL 8

Author Comment

by:plq
ID: 33742636
OMG I forgot to say... THANK YOU !.. cheers
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 33742644
:o)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

636 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