valami.cpp

00001 /* 
00002  *      Copyright (C) 2003-2005 Gabest
00003  *      http://www.gabest.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *   
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *   
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with GNU Make; see the file COPYING.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 
00022 #include "..\..\..\DSUtil\DSUtil.h"
00023 
00024 static TCHAR str1[][256] = 
00025 /*
00026 {
00027         _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{9D2935C7-3D8B-4EF6-B0D1-C14064698794}"), // divxg400
00028         _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{8CE3343E-2289-4BAE-AE57-5106A40AF552}"), // divxg400force
00029         _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{00A95963-3BE5-48C0-AD9F-3356D67EA09D}"), // ogg sub mixer
00030         _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{70E102B0-5556-11CE-97C0-00AA0055595A}"), // video renderer (old)
00031         _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{6BC1CFFA-8FC1-4261-AC22-CFB4CC38DB50}"), // video renderer (vmr)
00032 };
00033 */
00034 {
00035         {
00036                 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22, 
00037                 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f, 
00038                 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76, 
00039                 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22, 
00040                 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51, 
00041                 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61, 
00042                 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x2b, 
00043                 0x56, 0x20, 0x2b, 0x21, 0x27, 0x51, 0x25, 0x3f, 
00044                 0x21, 0x56, 0x2a, 0x50, 0x3f, 0x26, 0x57, 0x54, 
00045                 0x24, 0x3f, 0x50, 0x22, 0x56, 0x23, 0x3f, 0x51, 
00046                 0x23, 0x26, 0x22, 0x24, 0x26, 0x24, 0x2b, 0x2a, 
00047                 0x25, 0x2b, 0x26, 0x6f, 0x12
00048         },
00049         {
00050                 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22, 
00051                 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f, 
00052                 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76, 
00053                 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22, 
00054                 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51, 
00055                 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61, 
00056                 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x2a, 
00057                 0x51, 0x57, 0x21, 0x21, 0x26, 0x21, 0x57, 0x3f, 
00058                 0x20, 0x20, 0x2a, 0x2b, 0x3f, 0x26, 0x50, 0x53, 
00059                 0x57, 0x3f, 0x53, 0x57, 0x27, 0x25, 0x3f, 0x27, 
00060                 0x23, 0x22, 0x24, 0x53, 0x26, 0x22, 0x53, 0x54, 
00061                 0x27, 0x27, 0x20, 0x6f, 0x12
00062         },
00063         {
00064                 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22, 
00065                 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f, 
00066                 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76, 
00067                 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22, 
00068                 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51, 
00069                 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61, 
00070                 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x22, 
00071                 0x22, 0x53, 0x2b, 0x27, 0x2b, 0x24, 0x21, 0x3f, 
00072                 0x21, 0x50, 0x57, 0x27, 0x3f, 0x26, 0x2a, 0x51, 
00073                 0x22, 0x3f, 0x53, 0x56, 0x2b, 0x54, 0x3f, 0x21, 
00074                 0x21, 0x27, 0x24, 0x56, 0x24, 0x25, 0x57, 0x53, 
00075                 0x22, 0x2b, 0x56, 0x6f, 0x12
00076         },
00077         {
00078                 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22, 
00079                 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f, 
00080                 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76, 
00081                 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22, 
00082                 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51, 
00083                 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61, 
00084                 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x25, 
00085                 0x22, 0x57, 0x23, 0x22, 0x20, 0x50, 0x22, 0x3f, 
00086                 0x27, 0x27, 0x27, 0x24, 0x3f, 0x23, 0x23, 0x51, 
00087                 0x57, 0x3f, 0x2b, 0x25, 0x51, 0x22, 0x3f, 0x22, 
00088                 0x22, 0x53, 0x53, 0x22, 0x22, 0x27, 0x27, 0x27, 
00089                 0x2b, 0x27, 0x53, 0x6f, 0x12
00090         },
00091         {
00092                 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22, 
00093                 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f, 
00094                 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76, 
00095                 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22, 
00096                 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51, 
00097                 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61, 
00098                 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x24, 
00099                 0x50, 0x51, 0x23, 0x51, 0x54, 0x54, 0x53, 0x3f, 
00100                 0x2a, 0x54, 0x51, 0x23, 0x3f, 0x26, 0x20, 0x24, 
00101                 0x23, 0x3f, 0x53, 0x51, 0x20, 0x20, 0x3f, 0x51, 
00102                 0x54, 0x50, 0x26, 0x51, 0x51, 0x21, 0x2a, 0x56, 
00103                 0x50, 0x27, 0x22, 0x6f, 0x12
00104         },
00105 };
00106 
00107 static TCHAR str2[] = // _T("FilterData");
00108 {
00109         0x72, 0x5d, 0x58, 0x40, 0x51, 0x46, 0x70, 0x55, 
00110         0x40, 0x55, 0x34, 
00111 };
00112 
00113 static TCHAR str3[] = // _T("FriendlyName");
00114 {
00115         0x10, 0x24, 0x3f, 0x33, 0x38, 0x32, 0x3a, 0x2f, 
00116         0x18, 0x37, 0x3b, 0x33, 0x56, 
00117 };
00118 
00119 
00120 #define LEN1 (countof(str1))
00121 #define LEN11 (countof(str1[0]))
00122 #define LEN2 (countof(str2))
00123 #define LEN3 (countof(str3))
00124 
00125 static void dencode()
00126 {
00127         int i, j;
00128         for(i = 0; i < LEN1; i++) for(j = 0; j < LEN11; j++) str1[i][j] ^= 0x12;
00129         for(i = 0; i < LEN2; i++) str2[i] ^= 0x34;
00130         for(i = 0; i < LEN3; i++) str3[i] ^= 0x56;
00131 }
00132 
00133 extern /*const*/ AMOVIESETUP_FILTER sudFilter[2];
00134 
00135 void JajDeGonoszVagyok()
00136 {
00137         dencode();
00138 
00139         DWORD mymerit = sudFilter[1].dwMerit;
00140 
00141         for(int i = 0; i < LEN1; i++)
00142         {
00143                 HKEY hKey;
00144 
00145                 if(RegOpenKeyEx(HKEY_CLASSES_ROOT, str1[i], 0, KEY_READ, &hKey) == ERROR_SUCCESS)
00146                 {
00147                         BYTE* pData = NULL;
00148                         DWORD size = 0;
00149 
00150                         if(RegQueryValueEx(hKey, str2, 0, NULL, NULL, &size) == ERROR_SUCCESS)
00151                         {
00152                                 pData = new BYTE[size];
00153 
00154                                 if(pData && RegQueryValueEx(hKey, str2, 0, NULL, pData, &size) == ERROR_SUCCESS)
00155                                 {
00156                                         DWORD merit = *((DWORD*)(pData+4));
00157 
00158                                         if(merit < 0xffffffff) merit++;
00159 
00160                                         if(mymerit < merit) 
00161                                                 mymerit = merit;
00162                                 }
00163                                 
00164                                 if(pData) delete [] pData;
00165                         }
00166 
00167                         RegCloseKey(hKey);
00168                 }
00169         }
00170 
00171         if(mymerit > sudFilter[1].dwMerit)
00172         {
00173 /*
00174                 CString myguid = _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{9852A670-F845-491b-9BE6-EBD841B8A613}");
00175 
00176                 HKEY hKey;
00177 
00178                 if(RegOpenKeyEx(HKEY_CLASSES_ROOT, myguid, 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
00179                 {
00180                         BYTE* pData = NULL;
00181                         DWORD size = 0;
00182 
00183                         if(RegQueryValueEx(hKey, str2, 0, NULL, NULL, &size) == ERROR_SUCCESS)
00184                         {
00185                                 pData = new BYTE[size];
00186 
00187                                 if(pData && RegQueryValueEx(hKey, str2, 0, NULL, pData, &size) == ERROR_SUCCESS)
00188                                 {
00189                                         *((DWORD*)(pData+4)) = mymerit;
00190                                         if(RegSetValueEx(hKey, str2, 0, REG_BINARY, pData, size) != ERROR_SUCCESS)
00191                                         {
00192                                                 int i = 0;
00193                                         }
00194                                 }
00195                                 
00196                                 if(pData) delete [] pData;
00197                         }
00198 
00199                         RegCloseKey(hKey);
00200                 }
00201 */
00202                 sudFilter[1].dwMerit = mymerit;
00203         }
00204 
00205         dencode();
00206 }
00207 
00208 bool HmGyanusVagyTeNekem(IPin* pPin)
00209 {
00210         dencode();
00211 
00212         pPin->AddRef();
00213 
00214         bool fFail = false;
00215 
00216         for(int i = 0; i < 3 && !fFail; i++)
00217         {
00218                 BYTE* pData = NULL;
00219                 DWORD size = 0;
00220 
00221                 HKEY hKey;
00222                 
00223                 if(RegOpenKeyEx(HKEY_CLASSES_ROOT, str1[i], 0, KEY_READ, &hKey) == ERROR_SUCCESS)
00224                 {
00225                         if(RegQueryValueEx(hKey, str3, 0, NULL, NULL, &size) == ERROR_SUCCESS)
00226                         {
00227                                 pData = new BYTE[size];
00228 
00229                                 if(pData)
00230                                 {
00231                                         if(RegQueryValueEx(hKey, str3, 0, NULL, pData, &size) != ERROR_SUCCESS)
00232                                         {
00233                                                 delete [] pData;
00234                                                 pData = NULL;
00235                                         }
00236                                 }
00237                         }
00238 
00239                         RegCloseKey(hKey);
00240                 }
00241 
00242                 if(pData)
00243                 {               
00244                         CPinInfo pi;
00245                         if(SUCCEEDED(pPin->QueryPinInfo(&pi)) && pi.pFilter)
00246                         {
00247                                 CFilterInfo fi;
00248                                 if(SUCCEEDED(pi.pFilter->QueryFilterInfo(&fi))
00249                                 && !wcsncmp((WCHAR*)pData, fi.achName, wcslen((WCHAR*)pData)))
00250                                         fFail = true;
00251                         }
00252                         
00253                         delete [] pData;
00254                 }
00255         }
00256 
00257         pPin->Release();
00258 
00259         dencode();
00260 
00261         return(fFail);
00262 }

Generated on Tue Dec 13 14:47:53 2005 for guliverkli by  doxygen 1.4.5