Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 839
  • Last Modified:

Plink beeps

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
plq
Asked:
plq
  • 7
  • 5
1 Solution
 
ZoppoCommented:
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
 
plqAuthor Commented:
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
 
plqAuthor Commented:
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!

 
ZoppoCommented:
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
 
ZoppoCommented:
Yes, this could be right - I guess the '07' in the first line is the 'BEL' char ...
0
 
plqAuthor Commented:
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
 
plqAuthor Commented:
>>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
 
plqAuthor Commented:
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
 
plqAuthor Commented:
A simple loop through the ctx->buffer to replace 7 with 32 did the job nicely.
0
 
ZoppoCommented:
Fine, that's great ...

Have a nice day,

best regards,

ZOPPO
0
 
plqAuthor Commented:
OMG I forgot to say... THANK YOU !.. cheers
0
 
ZoppoCommented:
:o)
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now