Solved

Plink beeps

Posted on 2010-09-23
12
821 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
Industry Leaders: 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Title # Comments Views Activity
Arduino EDI - Programming language 3 117
Microsoft C++ code failing in executable that worked 9 124
How do i run a c++ file? 15 52
boost::uuid crashes 17 41
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 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.

730 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