Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Thursday, March 5, 2009

Working with Microsoft Speech API (SAPI)

SAPI or Speech Application Programming Interface is provided by Microsoft for converting text-to-speech and speech recognition.

Isn't it fun to have your own application which would read out text to you? Here is the sample vbscript code:

Dim name, sapi, reply
name = InputBox("Please enter your name","I would like to talk to you!")
Set sapi = CreateObject("sapi.spvoice")
Set sapi.Voice = sapi.GetVoices().Item(1)
reply = "Hello" & name
sapi.Speak reply
sapi.Speak "How are you doing?"

Save this code as "test.vbs" for example and run it. Enter your name in the prompt and enjoy the computer speaking to you :)

Explaining the code:
Line No.2 prompts the user to enter name. The name entered by user is saved in variable "name".
Line No.3 creates the sapi object for manipulation
Line No.4 selects the voice available in the system
Line No.5 adds Hello to the name
Line No.6 and 7 speaks out the string to the user

For more information on SAPI, Microsoft Speech API 5.3

Monday, March 2, 2009

Put your system to hibernate in a double click

So I am back with more tips for people who are lazy like me.

In one of my earlier, blogs I had mentioned, how lazy I felt to lock my desktop and how I wanted it in a double-click.

Well, being lazy again, now I have decided to put my system in hibernate or standby in a double click too.

Here's the code:

#include "windows.h"
#include "atlbase.h"

void create(TCHAR argv[100])
{
STARTUPINFO si;
PROCESS_INFORMATION pi;

ZeroMemory( & si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( & pi, sizeof(pi) );

// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line)
argv, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi ) // Pointer to PROCESS_INFORMATION structure
)
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return;
}

// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );

// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );

}
int _tmain(int argc, _TCHAR* argv[])
{
USES_CONVERSION;
char tmp_path[MAX_PATH];
char cmd[MAX_PATH];
strcpy_s(tmp_path, MAX_PATH,"%windir%\\System32\\rundll32.exe powrprof.dll,SetSuspendState");
ExpandEnvironmentStringsA(tmp_path, cmd, MAX_PATH);

TCHAR* str= A2T(cmd);
create(str);
}

Yahooooo... You are done!

Its too bad that blogger doesnt allow me to upload executables..else I would have just uploaded it for you. Maybe I should start a website for all these executables :)

Monday, December 29, 2008

Things I learnt from a virus

Today morning my colleague came upto me and told me that my system is pumping a hell lot of traffic in the office network. He suspected it to be a virus attack..so it became my responsibility to get it out of the system...

So started off with downloading Ethereal to analyze the packets going out from my system. Came to know that the virus was pumping ICMP packets at regular intervals. Now next was to identify which process was the culprit. Thats when Subbu helped me out. He told me about "Process Monitor" provided by "Sysinternal Suite". Using this tool I identified, the process named csrcs.exe was using the icmp.dll. This executable is found within system32 folder. [was found hidden]

Now deletion from registry:
1. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\Run
-Delete entry for csrcs.exe

2. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
-Remove the value csrcs.exe. Do maintain Explorer.exe[ Dont mess it up ]

I googled about this virus. Learned the following things:
Name:
W32.Spybot.CF Virus

Details:
This Trojan allows attackers to access your computer from remote locations, stealing passwords, Internet banking :( and personal data. This process is a security risk and should be removed from your system.It is not a Windows system file. Program listens for or sends data on open ports to LAN or Internet. csrcs.exe is able to hide itself, monitor applications. Therefore the technical security rating is 100% dangerous.

Click for more info about icmp.dll

Dont know what all information I have lost till now...But atleast i can feel safe that I found it before its too late...

Tuesday, December 23, 2008

Visual Studio 2005 build issue

Issue:
While trying to build a project in Visual Studio 2005, got the follwing output:

Embedding manifest...
Project : error PRJ0003 : Error spawning 'cmd.exe'.


Fix:
Change the MSVS 2005 options (Tools menu > Options > Project and Solutions > VC++ Directories) to ensure that
$(SystemRoot)
$(SystemRoot)\System32
$(SystemRoot)\System32\wbem
are specified BEFORE $(PATH)

If these are not already added, we need to manually add them in order and before $(PATH)

Saturday, November 29, 2008

Unblock Outlook attachments

Hacking is cool!! Don't you think so???

I am not going to say that I have discovered something new..but I did find this useful many at times..so I thought I would share it..

You all would have found that Microsoft Outlook blocks our attachments.(.exe,.bat,etc)..
It prompts us a message "Outlook blocked access to the following potentially unsafe attachments"

Since editing registries is my favorite subject..I have found the way to unblock this..Do it at your own risk..This will affect your security..but gives you a lot of freedom.. :-)

So here is the way..

1) Run regedit

2) Go to HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Security
(The version is 12.0 for Microsoft Outlook 2007 . If it is 2003 the version is 11.0 and for 2000, the version is 9.0)

3) Add a new String Value called: Level1Remove

4) Edit it and save the value data to the extension you wish to allow like .bat or .exe separated by semicolon
Eg:.bat;.exe

5) Restart Outlook.

And you are done!!!!

Wait for more hacks to come!!!!