shithub: aacdec

Download patch

ref: 635f1edc98fe8f8ce0f327e8151e3afa0c99a73c
parent: 763275b0c54ee025bdfd7429eed213f6a080b251
author: menno <menno>
date: Mon Sep 29 13:14:15 EDT 2003

New Winamp3 plugin code

--- a/plugins/winamp3/CRegistry.cpp
+++ b/plugins/winamp3/CRegistry.cpp
@@ -1,6 +1,6 @@
 /*
 CRegistry class
-Copyright (C) 2002 Antonio Foranna
+Copyright (C) 2003 Antonio Foranna
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -19,43 +19,27 @@
 kreel@tiscali.it
 */
 
-//#include "stdafx.h"
-#include <windows.h>
-#include <string.h>
-#include <memory.h>
 #include "CRegistry.h"
+//#include <stdlib.h>
 
+//************************************************************************************************
 
-
-// *****************************************************************************
-
-
-
 CRegistry::CRegistry()
 {
-	Key=NULL;
-	Path=NULL;
+	regKey=NULL;
+	path=NULL;
 }
-// -----------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------
 
 CRegistry::~CRegistry()
 {
-	Close();
+	if(regKey)
+		RegCloseKey(regKey);
+	if(path)
+		free(path);
 }
-// *****************************************************************************
-
-inline const HKEY CRegistry::GetKey()
-{
-	return Key;
-}
-// -----------------------------------------------------------------------------------------------
-
-inline const char *CRegistry::GetPath()
-{
-	return Path;
-}
-// *****************************************************************************
-
+//************************************************************************************************
+/*
 void CRegistry::ShowLastError(char *Caption)
 {
 LPVOID MsgBuf;
@@ -73,167 +57,108 @@
 		MessageBox(NULL, (LPCTSTR)MsgBuf, Caption, MB_OK|MB_ICONSTOP);
 	if(MsgBuf)
 		LocalFree(MsgBuf);
-}
+}*/
+//************************************************************************************************
 
+#define setPath(SubKey) \
+	if(path) \
+		free(path); \
+	path=strdup(SubKey);
 
-
-// *****************************************************************************
-
-
-
-#define SetPath(SubKeyName) \
-	if(Path) \
-		free(Path); \
-	Path=strdup(SubKeyName);
-
-// -----------------------------------------------------------------------------------------------
-
-BOOL CRegistry::Open(HKEY hKey, char *SubKeyName)
+BOOL CRegistry::Open(HKEY hKey, char *SubKey)
 {
-	if(Key)
-		Close();
-	if(RegOpenKeyEx(hKey, SubKeyName, NULL , KEY_ALL_ACCESS , &Key)==ERROR_SUCCESS)
+	if(regKey)
+		RegCloseKey(regKey);
+	if(RegOpenKeyEx(hKey, SubKey, NULL , KEY_ALL_ACCESS , &regKey)==ERROR_SUCCESS)
 	{
-		SetPath(SubKeyName);
+		setPath(SubKey);
 		return TRUE;
 	}
 	else // can't open the key -> error
 	{
-		Key=0;
-		SetPath("");
+		regKey=0;
+		setPath("");
 		return FALSE;
 	}
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
-BOOL CRegistry::OpenCreate(HKEY hKey, char *SubKeyName)
+BOOL CRegistry::OpenCreate(HKEY hKey, char *SubKey)
 {
-	if(Key)
-		Close();
-	if(RegOpenKeyEx(hKey, SubKeyName, NULL , KEY_ALL_ACCESS , &Key)==ERROR_SUCCESS)
+	if(regKey)
+		RegCloseKey(regKey);
+	if(RegOpenKeyEx(hKey, SubKey, NULL , KEY_ALL_ACCESS , &regKey)==ERROR_SUCCESS)
 	{
-		SetPath(SubKeyName);
+		setPath(SubKey);
 		return TRUE;
 	}
 	else // open failed -> create the key
 	{
 	DWORD disp;
-		RegCreateKeyEx(hKey , SubKeyName, NULL , NULL, REG_OPTION_NON_VOLATILE , KEY_ALL_ACCESS , NULL , &Key , &disp );
+		RegCreateKeyEx(hKey , SubKey, NULL , NULL, REG_OPTION_NON_VOLATILE , KEY_ALL_ACCESS , NULL , &regKey , &disp );
 		if(disp==REG_CREATED_NEW_KEY) 
 		{
-			SetPath(SubKeyName);
+			setPath(SubKey);
 			return TRUE;
 		}
 		else // can't create the key -> error
 		{
-			Key=0;
-			SetPath("");
+			regKey=0;
+			setPath("");
 			return FALSE;
 		}
 	}
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
-BOOL CRegistry::Close()
+void CRegistry::Close()
 {
-BOOL retVal=TRUE;
-	if(Key)
-		retVal=RegCloseKey(Key)==ERROR_SUCCESS;
-	Key=NULL;
-	if(Path) 
-		delete Path; 
-	Path=NULL;
-	return retVal;
+	if(regKey)
+		RegCloseKey(regKey);
+	regKey=NULL;
+	if(path) 
+		delete path; 
+	path=NULL;
 }
+//************************************************************************************************
+//************************************************************************************************
+//************************************************************************************************
 
-
-
-// *****************************************************************************
-
-
-
-inline BOOL CRegistry::DeleteVal(char *SubKeyName)
+void CRegistry::DeleteVal(char *SubKey)
 {
-	return RegDeleteValue(Key,SubKeyName)==ERROR_SUCCESS;
+	RegDeleteValue(regKey,SubKey);
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
-inline BOOL CRegistry::DeleteKey(char *SubKeyName)
+void CRegistry::DeleteKey(char *SubKey)
 {
-	return RegDeleteKey(Key,SubKeyName)==ERROR_SUCCESS;
+	RegDeleteKey(regKey,SubKey);
 }
-// -----------------------------------------------------------------------------------------------
 
-BOOL CRegistry::RecurseDeleteKey(char *SubKeyName)
-{
-CRegistry	SubKey;
-FILETIME	time;
-TCHAR		buf[256];
-DWORD		size=sizeof(buf)*sizeof(TCHAR),
-			len=size;
-DWORD		retVal;
+//************************************************************************************************
+//************************************************************************************************
+//************************************************************************************************
 
-	if(SubKey.Open(Key,SubKeyName)!=ERROR_SUCCESS)
-		return FALSE;
-	while((retVal=RegEnumKeyEx(SubKey.Key, 0, buf, &len, NULL, NULL, NULL, &time))==ERROR_SUCCESS)
-	{
-		if(!SubKey.RecurseDeleteKey(buf))
-		{
-			SubKey.Close();
-			return FALSE;
-		}
-		len=size;
-	}
-	SubKey.Close();
-	if(retVal!=ERROR_NO_MORE_ITEMS)
-		return FALSE;
-	return DeleteKey(SubKeyName);
-}
-// -----------------------------------------------------------------------------------------------
-
-inline BOOL CRegistry::EnumKey(DWORD Index, TCHAR *buf, DWORD size)
-{
-FILETIME	time;
-
-	return RegEnumKeyEx(Key, Index, buf, &size, NULL, NULL, NULL, &time)==ERROR_SUCCESS;
-}
-
-
-
-// *****************************************************************************
-
-
-
 void CRegistry::SetBool(char *keyStr , BOOL val)
 {
 BOOL tempVal;
 DWORD len;
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
 		tempVal!=val)
-		RegSetValueEx(Key , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(BOOL));
+		RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(BOOL));
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
-void CRegistry::SetBool(char *keyStr , bool val)
-{
-bool tempVal;
-DWORD len;
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
-		tempVal!=val)
-		RegSetValueEx(Key , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(bool));
-}
-// -----------------------------------------------------------------------------------------------
-
 void CRegistry::SetByte(char *keyStr , BYTE val)
 {
 DWORD	t=val;
 DWORD	tempVal;
 DWORD	len;
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
 		tempVal!=val)
-		RegSetValueEx(Key , keyStr , NULL , REG_DWORD , (BYTE *)&t , sizeof(DWORD));
+		RegSetValueEx(regKey , keyStr , NULL , REG_DWORD , (BYTE *)&t , sizeof(DWORD));
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
 void CRegistry::SetWord(char *keyStr , WORD val)
 {
@@ -240,31 +165,31 @@
 DWORD	t=val;
 DWORD	tempVal;
 DWORD	len;
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
 		tempVal!=val)
-		RegSetValueEx(Key , keyStr , NULL , REG_DWORD , (BYTE *)&t , sizeof(DWORD));
+		RegSetValueEx(regKey , keyStr , NULL , REG_DWORD , (BYTE *)&t , sizeof(DWORD));
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
 void CRegistry::SetDword(char *keyStr , DWORD val)
 {
 DWORD tempVal;
 DWORD len;
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
 		tempVal!=val)
-		RegSetValueEx(Key , keyStr , NULL , REG_DWORD , (BYTE *)&val , sizeof(DWORD));
+		RegSetValueEx(regKey , keyStr , NULL , REG_DWORD , (BYTE *)&val , sizeof(DWORD));
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
 void CRegistry::SetFloat(char *keyStr , float val)
 {
 float tempVal;
 DWORD len;
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS ||
 		tempVal!=val)
-		RegSetValueEx(Key , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(float));
+		RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(float));
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
 void CRegistry::SetStr(char *keyStr , char *valStr)
 {
@@ -274,19 +199,19 @@
 	if(!valStr || !*valStr)
 		return;
 
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, NULL , &len )!=ERROR_SUCCESS ||
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, NULL , &len )!=ERROR_SUCCESS ||
 		len!=slen)
-		RegSetValueEx(Key , keyStr , NULL , REG_SZ , (BYTE *)valStr , slen);
+		RegSetValueEx(regKey , keyStr , NULL , REG_SZ , (BYTE *)valStr , slen);
 	else
 	{
 	char *tempVal=new char[slen];
-		if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)tempVal , &len )!=ERROR_SUCCESS ||
+		if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)tempVal , &len )!=ERROR_SUCCESS ||
 			strcmpi(tempVal,valStr))
-			RegSetValueEx(Key , keyStr , NULL , REG_SZ , (BYTE *)valStr , slen);
+			RegSetValueEx(regKey , keyStr , NULL , REG_SZ , (BYTE *)valStr , slen);
 		delete tempVal;
 	}
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
 void CRegistry::SetValN(char *keyStr , BYTE *addr,  DWORD size)
 {
@@ -294,15 +219,15 @@
 	if(!addr || !size)
 		return;
 
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, NULL , &len )!=ERROR_SUCCESS ||
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, NULL , &len )!=ERROR_SUCCESS ||
 		len!=size)
-		RegSetValueEx(Key , keyStr , NULL , REG_BINARY , addr , size);
+		RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , addr , size);
 	else
 	{
 	BYTE *tempVal=new BYTE[size];
-		if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)tempVal , &len )!=ERROR_SUCCESS ||
+		if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)tempVal , &len )!=ERROR_SUCCESS ||
 			memcmp(tempVal,addr,len))
-			RegSetValueEx(Key , keyStr , NULL , REG_BINARY , addr , size);
+			RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , addr , size);
 		delete tempVal;
 	}
 }
@@ -309,7 +234,9 @@
 
 
 
-// *****************************************************************************
+//************************************************************************************************
+//************************************************************************************************
+//************************************************************************************************
 
 
 
@@ -318,43 +245,29 @@
 BOOL tempVal;
 DWORD len=sizeof(BOOL);
 
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
 	{
-		RegSetValueEx(Key , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(BOOL));
+		RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(BOOL));
 		return val;
 	}
 	return tempVal;
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
-bool CRegistry::GetSetBool(char *keyStr, bool val)
-{
-bool tempVal;
-DWORD len=sizeof(bool);
-
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
-	{
-		RegSetValueEx(Key , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(bool));
-		return val;
-	}
-	return tempVal;
-}
-// -----------------------------------------------------------------------------------------------
-
 BYTE CRegistry::GetSetByte(char *keyStr, BYTE val)
 {
 DWORD tempVal;
 DWORD len=sizeof(DWORD);
 
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
 	{
 		tempVal=val;
-		RegSetValueEx(Key , keyStr , NULL , REG_DWORD , (BYTE *)&tempVal , sizeof(DWORD));
+		RegSetValueEx(regKey , keyStr , NULL , REG_DWORD , (BYTE *)&tempVal , sizeof(DWORD));
 		return val;
 	}
 	return (BYTE)tempVal;
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
 WORD CRegistry::GetSetWord(char *keyStr, WORD val)
 {
@@ -361,15 +274,15 @@
 DWORD tempVal;
 DWORD len=sizeof(DWORD);
 
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
 	{
 		tempVal=val;
-		RegSetValueEx(Key , keyStr , NULL , REG_DWORD , (BYTE *)&tempVal , sizeof(DWORD));
+		RegSetValueEx(regKey , keyStr , NULL , REG_DWORD , (BYTE *)&tempVal , sizeof(DWORD));
 		return val;
 	}
 	return (WORD)tempVal;
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
 DWORD CRegistry::GetSetDword(char *keyStr, DWORD val)
 {
@@ -376,14 +289,14 @@
 DWORD tempVal;
 DWORD len=sizeof(DWORD);
 
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
 	{
-		RegSetValueEx(Key , keyStr , NULL , REG_DWORD , (BYTE *)&val , sizeof(DWORD));
+		RegSetValueEx(regKey , keyStr , NULL , REG_DWORD , (BYTE *)&val , sizeof(DWORD));
 		return val;
 	}
 	return (DWORD)tempVal;
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
 float CRegistry::GetSetFloat(char *keyStr, float val)
 {
@@ -390,20 +303,20 @@
 float tempVal;
 DWORD len=sizeof(float);
 
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)&tempVal , &len )!=ERROR_SUCCESS)
 	{
-		RegSetValueEx(Key , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(float));
+		RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , (BYTE *)&val , sizeof(float));
 		return val;
 	}
 	return tempVal;
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
 int CRegistry::GetSetStr(char *keyStr, char *tempString, char *dest, int maxLen)
 {
 DWORD tempLen=maxLen;
 	
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *) dest , &tempLen )!=ERROR_SUCCESS)
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *) dest , &tempLen )!=ERROR_SUCCESS)
 	{
 		if(!tempString)
 		{
@@ -412,17 +325,17 @@
 		}
 		strcpy(dest,tempString);
 		tempLen=strlen(tempString)+1;
-		RegSetValueEx(Key , keyStr , NULL , REG_SZ , (BYTE *)tempString , tempLen);
+		RegSetValueEx(regKey , keyStr , NULL , REG_SZ , (BYTE *)tempString , tempLen);
 	}
 	return tempLen;
 }
-// -----------------------------------------------------------------------------------------------
+//************************************************************************************************
 
 int CRegistry::GetSetValN(char *keyStr, BYTE *tempAddr, BYTE *addr, DWORD size)
 {
 DWORD tempLen=size;
 
-	if(RegQueryValueEx(Key , keyStr , NULL , NULL, (BYTE *)addr , &tempLen )!=ERROR_SUCCESS)
+	if(RegQueryValueEx(regKey , keyStr , NULL , NULL, (BYTE *)addr , &tempLen )!=ERROR_SUCCESS)
 	{
 		if(!tempAddr)
 		{
@@ -430,7 +343,7 @@
 			return 0;
 		}
 		memcpy(addr,tempAddr,size);
-		RegSetValueEx(Key , keyStr , NULL , REG_BINARY , (BYTE *)addr , size);
+		RegSetValueEx(regKey , keyStr , NULL , REG_BINARY , (BYTE *)addr , size);
 	}
 	return tempLen;
 }
--- a/plugins/winamp3/CRegistry.h
+++ b/plugins/winamp3/CRegistry.h
@@ -1,27 +1,13 @@
-/*
-CRegistry class
-Copyright (C) 2002 Antonio Foranna
+//---------------------------------------------------------------------------
+#ifndef CRegistryH
+#define CRegistryH
+//---------------------------------------------------------------------------
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation.
-	
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-		
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-			
-The author can be contacted at:
-kreel@tiscali.it
-*/
+#include <windows.h>
+#include <stdlib.h>
+//#include <string.h>
+//#include <memory.h>
 
-#ifndef registry_h
-#define registry_h
-
 class CRegistry 
 {
 public:
@@ -28,18 +14,13 @@
 			CRegistry();
 			~CRegistry();
 
-	void	ShowLastError(char *Caption);
-
 	BOOL	Open(HKEY hKey, char *SubKey);
 	BOOL	OpenCreate(HKEY hKey, char *SubKey);
-	BOOL	Close();
-	BOOL	DeleteVal(char *SubKey);
-	BOOL	DeleteKey(char *SubKey);
-	BOOL	RecurseDeleteKey(char *SubKey);
-	BOOL	EnumKey(DWORD Index, TCHAR *buf, DWORD size);
+	void	Close();
+	void	DeleteVal(char *SubKey);
+	void	DeleteKey(char *SubKey);
 
 	void	SetBool(char *keyStr , BOOL val);
-	void	SetBool(char *keyStr , bool val);
 	void	SetByte(char *keyStr , BYTE val);
 	void	SetWord(char *keyStr , WORD val);
 	void	SetDword(char *keyStr , DWORD val);
@@ -48,7 +29,6 @@
 	void	SetValN(char *keyStr , BYTE *addr,  DWORD size);
 
 	BOOL	GetSetBool(char *keyStr, BOOL var);
-	bool	GetSetBool(char *keyStr, bool var);
 	BYTE	GetSetByte(char *keyStr, BYTE var);
 	WORD	GetSetWord(char *keyStr, WORD var);
 	DWORD	GetSetDword(char *keyStr, DWORD var);
@@ -56,11 +36,8 @@
 	int		GetSetStr(char *keyStr, char *tempString, char *dest, int maxLen);
 	int		GetSetValN(char *keyStr, BYTE *tempAddr, BYTE *addr, DWORD size);
 
-	const HKEY	GetKey();
-	const char	*GetPath();
-
-private:
-	HKEY	Key;
-	char	*Path;
+	HKEY	regKey;
+	char	*path;
 };
+
 #endif
\ No newline at end of file
--- a/plugins/winamp3/Defines.h
+++ b/plugins/winamp3/Defines.h
@@ -1,4 +1,4 @@
 #define FILES_SUPPORT "MP4-AAC"
 #define APP_NAME "MPEG4-AAC"
 #define REGISTRY_PROGRAM_NAME "SOFTWARE\\4N\\Winamp3\\" APP_NAME
-#define APP_VER "v1.0"
+#define APP_VER "v1.1"
--- a/plugins/winamp3/FAAD.cpp
+++ b/plugins/winamp3/FAAD.cpp
@@ -23,8 +23,7 @@
 #include <stdio.h>
 #include <process.h>
 #include "resource.h"
-#include "faad.h"
-#include "..\..\..\faac\include\faac.h"
+#include "faadwa3.h"
 #include "cnv_FAAD.h"
 #include "CRegistry.h"
 #include "Defines.h"
@@ -37,10 +36,11 @@
 
 #define MAX_Channels	2
 #define	FAAD_STREAMSIZE	(FAAD_MIN_STREAMSIZE*MAX_Channels)
+/*
 #define RAW		0
 #define ADIF	1
 #define ADTS	2
-
+*/
 // -----------------------------------------------------------------------------------------------
 
 #define FREE_ARRAY(ptr) \
--- a/plugins/winamp3/FAAD_config.xml
+++ b/plugins/winamp3/FAAD_config.xml
@@ -3,11 +3,11 @@
 <WinampAbstractionLayer version="0.7">
    <groupdef id="FAAD.Config.Content">
 	<Wasabi:Text id="static" text="Profile" x="0" y="0" w="80" h="15" />
-    <Wasabi:Dropdownlist id="profile" feed="PROFILE" x="70" y="0" w="-80" relatw="1" h="20" cfgattrib="{3AF667AD-3CF8-459e-8C7C-BD8CD1D6F8C2};Profile" />
+	<Wasabi:Dropdownlist id="profile" feed="PROFILE" x="70" y="0" w="-80" relatw="1" h="20" cfgattrib="{3AF667AD-3CF8-459e-8C7C-BD8CD1D6F8C2};Profile" />
 	<Wasabi:Text id="static" text="Samplerate" x="0" y="28" w="80" h="15" />
-    <Wasabi:Combobox id="samplerate" feed="SAMPLERATE" x="70" y="28" w="-80" relatw="1" h="20" cfgattrib="{3AF667AD-3CF8-459e-8C7C-BD8CD1D6F8C2};Samplerate" />
+	<Wasabi:Combobox id="samplerate" feed="SAMPLERATE" x="70" y="28" w="-80" relatw="1" h="20" cfgattrib="{3AF667AD-3CF8-459e-8C7C-BD8CD1D6F8C2};Samplerate" />
 	<Wasabi:Text id="static" text="Bps" x="0" y="56" w="80" h="15" />
-    <Wasabi:Dropdownlist id="bps" feed="BPS" x="70" y="56" w="-80" relatw="1" h="20" cfgattrib="{3AF667AD-3CF8-459e-8C7C-BD8CD1D6F8C2};Bps" />
+	<Wasabi:Dropdownlist id="bps" feed="BPS" x="70" y="56" w="-80" relatw="1" h="20" cfgattrib="{3AF667AD-3CF8-459e-8C7C-BD8CD1D6F8C2};Bps" />
    </groupdef>
 
    <groupdef id="FAAD.About.Content">
--- a/plugins/winamp3/Readme.txt
+++ b/plugins/winamp3/Readme.txt
@@ -18,7 +18,7 @@
 
 To use it:
 ----------
-1) Put "Wasabi SDK" folder into the folder where my sources are placed;
+1) Copy "Wasabi SDK\Studio" folder into the folder where my sources are placed and rename it "SDK";
 
 2) Build it;
 
--- a/plugins/winamp3/cnv_FAAD.cpp
+++ b/plugins/winamp3/cnv_FAAD.cpp
@@ -20,7 +20,6 @@
 */
 
 #include <stdlib.h>
-#include "..\..\..\faac\include\faac.h"
 #include "cnv_FAAD.h"
 #include "faadwa3.h"
 #include "CRegistry.h"
@@ -32,7 +31,7 @@
 { 
 CRegistry reg;
 
-	if(reg.OpenCreate(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME  "\\FAAD"))
+	if(reg.OpenCreate(HKEY_CURRENT_USER,REGISTRY_PROGRAM_NAME  "\\FAAD"))
 	{
 		cfg->defObjectType=reg.GetSetByte("Profile",LOW);
 		cfg->defSampleRate=reg.GetSetDword("SampleRate",44100);
@@ -47,7 +46,7 @@
 { 
 CRegistry reg;
 
-	if(reg.OpenCreate(HKEY_LOCAL_MACHINE,REGISTRY_PROGRAM_NAME  "\\FAAD"))
+	if(reg.OpenCreate(HKEY_CURRENT_USER,REGISTRY_PROGRAM_NAME  "\\FAAD"))
 	{
 		reg.SetByte("Profile",cfg->defObjectType); 
 		reg.SetDword("SampleRate",cfg->defSampleRate); 
@@ -72,10 +71,10 @@
 { 0x3af667ad, 0x3cf8, 0x459e, { 0x8c, 0x7c, 0xbd, 0x8c, 0xd1, 0xd6, 0xf8, 0xc2 } };
 
 #include <attribs/attrstr.h>
-#define FEEDID_SAMPLERATE "SAMPLERATE"
-_string cfg_samplerate("Samplerate", "44100");
 #define FEEDID_PROFILE "PROFILE"
 _string cfg_profile("Profile", "Low Complexity");
+#define FEEDID_SAMPLERATE "SAMPLERATE"
+_string cfg_samplerate("Samplerate", "44100");
 #define FEEDID_BPS "BPS"
 _string cfg_bps("Bps", "16");
 
@@ -90,8 +89,8 @@
  public:
   TextFeed()
   {
-    registerFeed(FEEDID_SAMPLERATE);
     registerFeed(FEEDID_PROFILE);
+    registerFeed(FEEDID_SAMPLERATE);
     registerFeed(FEEDID_BPS);
   }
   static const char *getServiceName() { return "FAAD TextFeed Service"; }
@@ -109,7 +108,7 @@
 WACNAME::WACNAME() : WAComponentClient(FILES_SUPPORT " files support")
 {
 #ifdef FORTIFY
-    FortifySetName("cnv_FAAC.wac");
+    FortifySetName("cnv_FAAD.wac");
     FortifyEnterScope();
 #endif
 }
@@ -134,8 +133,8 @@
     api->service_register(&svc_feed);
 //	following line is long and causes a crash
 //	svc_feed.getSingleService()->sendFeed(FEEDID_SAMPLERATE,"6000;8000;11025;16000;22050;32000;44100;48000;64000;88200;96000;192000");
-	svc_feed.getSingleService()->sendFeed(FEEDID_SAMPLERATE,"8000;11025;16000;22050;32000;44100;48000;96000");
 	svc_feed.getSingleService()->sendFeed(FEEDID_PROFILE,"Main;Low Complexity;SSR;LTP");
+	svc_feed.getSingleService()->sendFeed(FEEDID_SAMPLERATE,"8000;11025;16000;22050;32000;44100;48000;96000");
 	svc_feed.getSingleService()->sendFeed(FEEDID_BPS,"16;24;32;FLOAT");
 }
 
@@ -142,13 +141,13 @@
 void WACNAME::onDestroy()
 {
     api->service_deregister(&aacpcm);
-    WAComponentClient::onDestroy();
-
     api->service_deregister(&svc_feed);
 
+    WAComponentClient::onDestroy();
+
 faacDecConfiguration	Cfg;
-	Cfg.defSampleRate=atoi(cfg_samplerate);
 	Cfg.defObjectType=atoi(cfg_profile);
+	Cfg.defSampleRate=atoi(cfg_samplerate);
 	Cfg.outputFormat=atoi(cfg_bps);
 	WriteCfgDec(&Cfg);
 }
@@ -195,7 +194,7 @@
 		cfg_bps="FLOAT";
 		break;
 	}
-	registerAttribute(&cfg_samplerate);
 	registerAttribute(&cfg_profile);
+	registerAttribute(&cfg_samplerate);
 	registerAttribute(&cfg_bps);
 }
--- a/plugins/winamp3/cnv_FAAD.dsp
+++ b/plugins/winamp3/cnv_FAAD.dsp
@@ -25,7 +25,7 @@
 # PROP AllowPerConfigDependencies 0
 # PROP Scc_ProjName ""
 # PROP Scc_LocalPath ""
-CPP=xicl6.exe
+CPP=cl.exe
 MTL=midl.exe
 RSC=rc.exe
 
@@ -43,7 +43,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CNV_FAAD_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../faad2/common/faad" /I "../../include" /I "../../../faad2/common/mp4v2" /I "SDK" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CNV_FAAD_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../common/faad" /I "../../common/mp4v2" /I "../../include" /I "SDK" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CNV_FAAD_EXPORTS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x410 /d "NDEBUG"
@@ -51,7 +51,7 @@
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
-LINK32=xilink6.exe
+LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
 # ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /machine:I386 /out:"Release/cnv_FAAD.wac"
 
@@ -69,7 +69,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CNV_FAAD_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../faad2/common/faad" /I "../../include" /I "../../../faad2/common/mp4v2" /I "SDK" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CNV_FAAD_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../faad2/common/faad" /I "../../../faad2/common/mp4v2" /I "../../common/faad" /I "../../include" /I "../../common/mp4v2" /I "SDK" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CNV_FAAD_EXPORTS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /GZ /c
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x410 /d "_DEBUG"
@@ -77,9 +77,9 @@
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
-LINK32=xilink6.exe
+LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"D:\Programmi\Winamp3\Wacs\cnv_FAAD.wac" /pdbtype:sept
+# ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Programmi\Winamp3\Wacs\cnv_FAAD.wac" /pdbtype:sept
 # SUBTRACT LINK32 /force
 
 !ENDIF 
@@ -198,6 +198,10 @@
 # Begin Source File
 
 SOURCE=.\Defines.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\faadwa3.h
 # End Source File
 # Begin Source File
 
--- a/plugins/winamp3/cnv_FAAD.h
+++ b/plugins/winamp3/cnv_FAAD.h
@@ -33,7 +33,7 @@
 
 
 #include <attribs/attrstr.h>
-extern _string	cfg_samplerate;
+extern _string cfg_samplerate;
 extern _string cfg_profile;
 extern _string cfg_bps;
 
--- a/plugins/winamp3/faadwa3.h
+++ b/plugins/winamp3/faadwa3.h
@@ -28,11 +28,13 @@
 #include <studio/wac.h>
 #include <attribs/cfgitemi.h>
 #include <attribs/attrint.h>
+
+#include <mp4.h>
+#include "..\..\..\faac\include\faac.h"
 #include <faad.h>
 extern "C" {
 #include <aacinfo.h>    // get_AAC_format()
 }
-#include <mp4.h>
 #include "Defines.h"