473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

VC++ project crashes in Windows 9x

Hi, I found a program on the net and I'm having some problems with it.

Basically what this program does is communicate with Winamp, but it can
use the functions that are supposed to work only for Winamp plugins.

The problem is that it crashes in Windows 9x, can somebody please take a
look to it? It's very small :-)

I don't remember where I got it from, so I posted it here:
http://360software.dakotabcn.net/temp/WinampMagic.zip
Any help will be greatly appreciated.
Thanks a lot.

Jul 23 '05 #1
7 1544

"Mariano López" <vi******************@infovia.com.ar> wrote in message
news:36*************@individual.net...
Hi, I found a program on the net and I'm having some problems with it.

Basically what this program does is communicate with Winamp, but it can
use the functions that are supposed to work only for Winamp plugins.

The problem is that it crashes in Windows 9x, can somebody please take a
look to it? It's very small :-)

I don't remember where I got it from, so I posted it here:
http://360software.dakotabcn.net/temp/WinampMagic.zip
Any help will be greatly appreciated.


http://www.slack.net/~shiva/welcome.txt

-Mike
Jul 23 '05 #2
Mike Wahler wrote:
"Mariano López" <vi******************@infovia.com.ar> wrote in message
news:36*************@individual.net...
Hi, I found a program on the net and I'm having some problems with
it.

Basically what this program does is communicate with Winamp, but it
can use the functions that are supposed to work only for Winamp
plugins.

The problem is that it crashes in Windows 9x, can somebody please
take a look to it? It's very small :-)

I don't remember where I got it from, so I posted it here:
http://360software.dakotabcn.net/temp/WinampMagic.zip
Any help will be greatly appreciated.


http://www.slack.net/~shiva/welcome.txt

-Mike

What was wrong with my post?

Jul 23 '05 #3
* =?Windows-1252?Q?Mariano_L=F3pez?=:

What was wrong with my post?


Platform-specific.

See the link that Mike provided.

Read responses before responding to them.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #4
Alf P. Steinbach wrote:
* =?Windows-1252?Q?Mariano_L=F3pez?=:

What was wrong with my post?


Platform-specific.

See the link that Mike provided.

Read responses before responding to them.


I read the page... ¬_¬

Well, I thought there was no problem in posting it as I saw a few post about
VC below.

Anyways, I use Delphi and I don't know if that code can compile in other C++
versions, so, sorry, I didn't know. Could you at least see it?

Jul 23 '05 #5

"Mariano López" <vi******************@infovia.com.ar> wrote in message
news:36*************@individual.net...
Alf P. Steinbach wrote:
* =?Windows-1252?Q?Mariano_L=F3pez?=:

What was wrong with my post?
Platform-specific.

See the link that Mike provided.

Read responses before responding to them.


I read the page... ¬_¬


Did you read *all* of it? Did you understand what you read?
Well, I thought there was no problem in posting it as I saw a few post about VC below.
That's right, you're not the only one who has posted off-topic
material here. People who do will be advised about topicalily.
Also, sometimes even when a post is topical, some folks will
use e.g. "VC" or some other non-C++ term in their subject line.
That's no problem as long as the message content is topical
(i.e. only concerning the standard C++ language).
Anyways, I use Delphi
Correct me if I'm wrong but isn't Delphi a (Borland) dialect of
Pascal?
and I don't know if that code can compile in other C++
versions,
I don't think Delphi is C++, but in any event, it's not
topical here. We discuss only the language here, not
particular products.
so, sorry, I didn't know. Could you at least see it?


I didn't see it, because I didn't look.

1. I didn't need to look because your message clearly indicated
it's not about standard C++.

2. Most folks won't download binary files due to concern
about computer viruses.
-Mike

Jul 23 '05 #6
Mike Wahler wrote:
"Mariano López" <vi******************@infovia.com.ar> wrote in message
news:36*************@individual.net...
Alf P. Steinbach wrote:
* =?Windows-1252?Q?Mariano_L=F3pez?=:

What was wrong with my post?

Platform-specific.

See the link that Mike provided.

Read responses before responding to them.
I read the page... ¬_¬


Did you read *all* of it? Did you understand what you read?


I read most of it, sorry but it was 6 a.m. and I was going to bed.

Well, I thought there was no problem in posting it as I saw a few
post about VC below.


That's right, you're not the only one who has posted off-topic
material here. People who do will be advised about topicalily.
Also, sometimes even when a post is topical, some folks will
use e.g. "VC" or some other non-C++ term in their subject line.
That's no problem as long as the message content is topical
(i.e. only concerning the standard C++ language).


I shouldn't have put VC++ in the subject line, it's a console application
and I don't know if it will compile in other C++.
Anyways, I use Delphi


Correct me if I'm wrong but isn't Delphi a (Borland) dialect of
Pascal?


Yes, I don't know C++, I just know how to translate some stuff from C++ to
Delphi.
and I don't know if that code can compile in other C++
versions,


I don't think Delphi is C++, but in any event, it's not
topical here. We discuss only the language here, not
particular products.
so, sorry, I didn't know. Could you at least see it?


I didn't see it, because I didn't look.

1. I didn't need to look because your message clearly indicated
it's not about standard C++.


I'm still not sure about that...

2. Most folks won't download binary files due to concern
about computer viruses.


It's a zip file with text files, for god's sake! How can that have a virus?

Anyways, here's the code I was working with (requires winamp.h from the
Winamp SDK or http://360software.dakotabcn.net/temp/WinampMagic.zip):
#include <stdio.h>
#include <windows.h>
#include <malloc.h>
#include "winamp.h"

#define METASIZE 128

HWND hwndWinamp;

//returns NULL if alloc failed, returns remote address otherwise
void *AllocWinamp(unsigned long bufsize)
{
void *remoteBuf;
HANDLE hWinamp;
unsigned long dWinamp;

// find the process id
GetWindowThreadProcessId(hwndWinamp, &dWinamp);

// open the process object
hWinamp = OpenProcess(PROCESS_ALL_ACCESS,false,dWinamp);
if(hWinamp == NULL) return NULL;

// allocate chunk of memory in winamp's address space
remoteBuf = VirtualAllocEx(hWinamp, NULL, bufsize, MEM_COMMIT,
PAGE_READWRITE);

CloseHandle(hWinamp);
return remoteBuf;
}

// returns 0 on success (it's winamp's problem if it fails... right?)
int FreeWinamp(void *remoteBuf, unsigned long bufsize)
{
int isError;
HANDLE hWinamp;
unsigned long dWinamp;

// find the process id
GetWindowThreadProcessId(hwndWinamp, &dWinamp);

// open the process object
hWinamp = OpenProcess(PROCESS_ALL_ACCESS,false,dWinamp);
if(hWinamp == NULL) return 2;

// free the memory in winamp's space
isError = VirtualFreeEx(hWinamp, remoteBuf, bufsize, MEM_DECOMMIT);
if(!isError)
{
CloseHandle(hWinamp);
return isError;
}

// release it
isError = VirtualFreeEx(hWinamp, remoteBuf, 0, MEM_RELEASE);
if(!isError)
{
CloseHandle(hWinamp);
return isError;
}

CloseHandle(hWinamp);
return 0;
}

// returns how many bytes were copied to local buffer
unsigned long ReadWinampToLocal(void *remoteBuf, void *localBuf, unsigned
long bufsize)
{
int isError;
HANDLE hWinamp;
unsigned long dWinamp;

// find the process id
GetWindowThreadProcessId(hwndWinamp, &dWinamp);

// open the process object
hWinamp = OpenProcess(PROCESS_ALL_ACCESS,false,dWinamp);
if(hWinamp == NULL) return 0;

isError = ReadProcessMemory(hWinamp, remoteBuf, localBuf, bufsize, NULL);

CloseHandle(hWinamp);

if(!isError) return 0;
else return bufsize;
}

// returns how many bytes were written to winamp's space
unsigned long WriteLocalToWinamp(void *localBuf, void *remoteBuf, unsigned
long bufsize)
{
int isError;
HANDLE hWinamp;
unsigned long dWinamp;

// find the process id
GetWindowThreadProcessId(hwndWinamp, &dWinamp);

// open the process object
hWinamp = OpenProcess(PROCESS_ALL_ACCESS,false,dWinamp);
if(hWinamp == NULL) return 0;

isError = WriteProcessMemory(hWinamp, remoteBuf, localBuf, bufsize, NULL);

CloseHandle(hWinamp);

if(!isError) return 0;
else return bufsize;
}

int GetPlayingTrack()
{
return SendMessage(hwndWinamp,WM_WA_IPC,0,IPC_GETLISTPOS) ;
}

char *GetMetaInfo(char *whichInfo, char *returnVal)
{
char *remoteBuf, *whichBuf, *structBuf;
static extendedFileInfoStruct xstruct;

// allocate the memory in winamp's space
remoteBuf = (char *)AllocWinamp(METASIZE);
whichBuf = (char *)AllocWinamp(sizeof(whichInfo));
structBuf = (char *)AllocWinamp(sizeof(xstruct));

// fill in ext struct
xstruct.filename = (char *)SendMessage(hwndWinamp, WM_WA_IPC,
GetPlayingTrack(), IPC_GETPLAYLISTFILE);
xstruct.metadata = whichBuf;
xstruct.ret = remoteBuf;
xstruct.retlen = METASIZE;

// write the local buffers to winamp's space
WriteLocalToWinamp(whichInfo, whichBuf, strlen(whichInfo));
WriteLocalToWinamp(&xstruct, structBuf, sizeof(xstruct));

// send the "get ext info call"
if(!SendMessage(hwndWinamp,WM_WA_IPC,(int)structBu f,IPC_GET_EXTENDED_FILE_INFO_HOOKABLE))
{
printf("Extended file information not available.\n");
return "no_ex";
}

// copy the remote buffer to local space
ReadWinampToLocal(remoteBuf, returnVal, METASIZE);

// free up the memory we allocated in winamp's space
FreeWinamp(remoteBuf, METASIZE);
FreeWinamp(whichBuf, sizeof(whichBuf));
FreeWinamp(structBuf, sizeof(xstruct));
return returnVal;
}

int main(int argc, char* argv[])
{
char *returnVal;
int length;

returnVal = (char *)malloc(MAX_PATH*sizeof(char));

hwndWinamp = FindWindowA("Winamp v1.x",NULL);

if(hwndWinamp == NULL)
{
printf("Winamp not running.\n");
return 0;
}

ReadWinampToLocal((char *)SendMessage(hwndWinamp, WM_WA_IPC,
GetPlayingTrack(), IPC_GETPLAYLISTFILE), returnVal, MAX_PATH);

printf("\nCurrently Playing song: %s\n\n", returnVal);
printf("Artist: %s\n", GetMetaInfo("Artist", returnVal));
printf("Title: %s\n", GetMetaInfo("Title", returnVal));
printf("Album: %s\n", GetMetaInfo("Album", returnVal));
printf("Year: %s\n", GetMetaInfo("Year", returnVal));
printf("Bitrate: %s kbps\n", GetMetaInfo("Bitrate", returnVal));

// in milliseconds
length = atoi(GetMetaInfo("Length", returnVal));
printf("Length: %d:%02d\n", length/(1000*60), (length/1000)%60);

free(returnVal);

return 0;
}

Jul 23 '05 #7
"Mariano López" <vi******************@infovia.com.ar> wrote in message
news:36*************@individual.net...

Anyways, here's the code I was working with (requires winamp.h from the
Winamp SDK or http://360software.dakotabcn.net/temp/WinampMagic.zip):


I've run out of ways to explain why your query is not
topical for comp.lang.c++, so I'll give up now, but
in parting, I'll remind you that the link I posted has
information about where you *can* get help with your
questions.

-Mike
Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Scott Chang | last post by:
Hi all I copied the following VC++ 6.0 code (written by someone in the website) to my VC++ .Net 2002-Windows XP Pro PC ////****Solution 'dyndllclass' (2 projects)***/// ///***dynapp****(1st...
8
by: Daniel Yelland | last post by:
Hi, I have developed a number of code libraries in Win32 DLLs and have written a number of test suite executables that implicitly link to these libraries in order to test them. In one of my test...
1
by: Fabuio | last post by:
Hi, we are writing a program which uses some third party APIs librares. Those APIs are dinamically linked to the MSVCR71.DLL. Unfortunately, we are compiling with the C++ DOT NET 7, which uses...
5
by: Pardeep Singh | last post by:
Hi all, I am migrating modules from VC++6 to VC++7. All the dll and exe modules are compiled successfully, but the applications crashes at startup. Please guide me what are the proper steps to...
11
by: Dr. Zharkov | last post by:
We want to export myArrayVB (2000, 2) of VB .NET 2003 in myArrayVó of VC++ .NET 2003 on scheme "component - client". But there is an error. For development of a component in VB .NET 2003 we...
0
by: parekh | last post by:
Hi All , I am facing a problem wherein my VB project is not recognizing a change in the argument list of a method ( the method itself being declared and defined in another VC++ project and it...
4
by: nmrcarl | last post by:
I'm trying to upgrade a large project from VS 6.0 to VS 2005. After fixing a lot of things that changed (mostly sloppy coding in the original project that VS2005 didn't allow), I got the release...
7
by: PawelSokolowski | last post by:
Hi all, I have a project originaly created in VC++ 6.0 then migrated to VC++ 2003. Unfortunatelly after compiling in the 2003 version it does not work in Windows 98. I am using only MFC, so...
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.