/* * Jon Lech Johansen */ using System; using System.IO; using System.Text; using Microsoft.Win32; using System.Windows.Forms; class MainClass { public static void Main( string[] args ) { try { RegistryKey hklm = Registry.LocalMachine; hklm = hklm.OpenSubKey( "SOFTWARE\\GoogleVideoViewer\\VLC" ); Object obp = hklm.GetValue( "InstallDir" ); string file_path = String.Format( "{0}{1}plugins{2}libaccess_http_plugin.dll", obp, Path.DirectorySeparatorChar, Path.DirectorySeparatorChar ); using( Stream s = new FileStream( file_path, FileMode.Open, FileAccess.Read | FileAccess.Write ) ) { int offset = 0; long file_pos = 0; int bytes_read = 0; byte[] buffer = new byte[ 65536 ]; byte[] search_bytes = new byte[] { 0xBF, 0x40, 0x65, 0x00, 0x10, 0xE9, 0x36, 0xFC, 0xFF, 0xFF }; while( ( bytes_read = s.Read( buffer, offset, buffer.Length - offset ) ) > 0 ) { for( int i = 0; i < bytes_read + offset - search_bytes.Length; i++ ) { bool match = true; for( int j = 0; j < search_bytes.Length; j++ ) { if( search_bytes[ j ] != buffer[ i + j ] ) { match = false; break; } } if( match ) { s.Seek( file_pos + i - offset, SeekOrigin.Begin ); for( int j = 0; j < search_bytes.Length; j++ ) search_bytes[ j ] = 0x90; s.Write( search_bytes, 0, search_bytes.Length ); MessageBox.Show( "GoogleVideoViewer was successfully patched", "GVVPatch" ); return; } } file_pos = s.Position; offset = search_bytes.Length; for( int i = 0; i < offset; i++ ) { buffer[ i ] = buffer[ buffer.Length - offset + i ]; } } } MessageBox.Show( "Error: Could not find bytes to patch. File already patched?", "GVVPatch" ); } catch( Exception e ) { MessageBox.Show( "Error: " + e.Message, "GVVPatch" ); } } }