Jump to content

To Dual Monitor users-Flash window fullscreen fix


Quual
 Share

Recommended Posts

If you ever use dual monitors and really hate that you can't full screen a flash video (Hulu / Fancast etc...) Because the moment the window loses focus the full screen mode switches off. I discovered a fix that requires using a hex editor to patch one of the adobe dll files.

Because a friend of mine has the same issue (and I would NEVER trust him with a hex editor), I spent the last hour or so making a script that safely preforms this patch. Knowing how my friend is , I built in a fair amount of checks to make sure the wrong file isn't patched and made it possible to restore the original information when ran a 2nd time.

Hopefully it helps someone else out there as well.

Global $debug = False
start()

Func start()    
    If Not FileExists(@SystemDir & '\Macromed\Flash\NPSWF32.dll') Then
        FindDll('NPSWF32.dll')
    Else
        VerifyDll(@SystemDir & '\Macromed\Flash\NPSWF32.dll')
    EndIf
EndFunc

Func VerifyDll($sDll)
    Local $sVer,$oFSO
    $oFSO = ObjCreate("Scripting.FileSystemObject")
    $sVer = $oFSO.GetFileVersion( $sDll )
    If $sVer <> '10.0.22.87' Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Version <> 10.0.22.87' & @crlf);### Debug Console
        If Not WrongVersion($sVer,'10.0.22.87') Then
            $oFSO = 0
            Exit
        EndIf   
    EndIf   
    $oFSO = 0
    Patchit($sDll)
EndFunc

Func Patchit($sDll)
    Local $hDLL, $bFile, $bReplace, $bReplacement, $bPart1, $bPart2, $bTarget
    $hDLL = FileOpen($sDll,16)
    If @error = -1 Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') File open (read binary mode) failed' & @crlf);### Debug Console
        FileOpenFail()
        Exit
    EndIf
    $bFile = FileRead($hDLL)
    If @error = 1 Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Read failed' & @crlf);### Debug Console
        FileReadFail()
        Exit
    EndIf   
    FileClose($hDLL)

    If BinaryLen($bFile) <> 3771296 Then
        If Not WrongSize(BinaryLen($sDll),3771296) Then Exit
    EndIf
    
    $bPart1 = BinaryMid($bFile, 1, 1270591)
    $bTarget = BinaryMid($bFile, 1270592, 2)
    $bPart2 = BinaryMid($bFile, 1270594, BinaryLen($bFile))
    
    If $bTarget = Binary("0x0074") Then
        $bTarget = Binary("0x00EB")
        $ReplacementMsg = '   0xEB Indicates that this file is not currently pathed.      ' & @CRLF & @CRLF & '   Would you like to patch it now?'
    ElseIf $bTarget = Binary("0x00EB") Then 
        $bTarget = Binary("0x0074")
        $ReplacementMsg = '   0x74 Indicates that this file has been patched.     ' & @CRLF & @CRLF & '   Would you like to remove the patch?'
    Else
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Byte not match 74 or EB' & @crlf);### Debug Console
        BinNotMatch(Binary("0x0074"),$bTarget)
        Exit
    EndIf
    
    $bReplace = $bPart1 & $bTarget & $bPart2    
    If BinaryLen($bReplace) <> BinaryLen($bFile) Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Replacment file length <> Original file length' & @crlf);### Debug Console
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $bFile = ' & BinaryLen($bFile) & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $bReplace = ' & BinaryLen($bReplace) & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
        
        MsgBox(0,'FullScreen Fix - Error','   Critical error the length of the original file' & @CRLF & _
        '     and the length of the new file would have not been the same.    ' & @CRLF & _
        '     Commit changes to file has beeen aborted. ' & @CRLF & @CRLF & _
        '     Uknown reason how or why this would happen. ' & @CRLF & @CRLF & '   Exiting....' & @CRLF)
        Exit
    EndIf
    If MsgBox(4,'FullScreen Fix - Patch','    Found the target dll file, ' & $sDll & '.' & @CRLF & @CRLF & _
        '     Location 0x136340 - 0x136341 equals 0x' & StringRight($bTarget,2) & @CRLF & @CRLF & $ReplacementMsg & @CRLF & @CRLF ) = 6 Then
        $hDLL = FileOpen($sDll,18)
        If @error = -1 Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') File open (binary overwrite mode) failed' & @crlf);### Debug Console
            FileOpenFail()
            Exit
        EndIf           
        If Not FileWrite($hDLL,$bReplace) Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') File write failed' & @crlf);### Debug Console
            FileClose($hDLL)
            FileWriteFail()
            Exit
        EndIf
        FileClose($hDLL)
    EndIf
    Exit    
EndFunc

Func BinNotMatch($bIs,$bShouldbe)
    MsgBox(0,'FullScreen Fix - Error','   The 2 bytes at location 0x136340 should be' & $bShouldbe & ',   ' & @CRLF & _
    '     however they are ' & $bIs & @CRLF & @CRLF & _
    '      Critical failure...Exiting....'  & @CRLF)
    Return False
EndFunc

Func FileOpenFail() 
    MsgBox(0,'FullScreen Fix - Error','   Unable to open file, File may be in use.    ' & @CRLF & _
    '     Try the following' & @CRLF & _
    '       Quit any applications that maybe using flash.' & @CRLF & _
    '       Restart your system.' & @CRLF & _
    '       Use an account with administrator privledges.' & @CRLF & _
    '       Check permissions to make sure you have read & write privledges.' & @CRLF & @CRLF & _
    '     Critical failure...Exiting....'  & @CRLF & @CRLF)
    Return False
EndFunc

Func WrongVersion($sVerIs, $sVerShouldBe)
    If MsgBox(4,'FullScreen Fix - Error','The dll file version should be' & $sVerShouldBe & ',' & @CRLF & _
    "     however it returned a version of " & $sVerIs & @CRLF & _
    "     It's possible this information is in error." & @CRLF & _
    '     There are a number of additional checks to make sure the wrong file does not get patched    ' & @CRLF & @CRLF & _
    '     Would you like to continue ?' & @CRLF & @CRLF) = 6 Then Return True
EndFunc

Func WrongSize($nSizeIs, $nSizeShouldBe)
    If MsgBox(4,'FullScreen Fix - Error', 'The dll file size should be' & $nSizeShouldBe & ',' & @CRLF & _
    "however it is " & $nSizeIs & @CRLF & _
    "It's possible the patch may work still." & @CRLF & _
    'There are a number of additional checks to make sure the wrong file does not get patched' & @CRLF & @CRLF & _
    'Would you like to continue ?' & @CRLF & @CRLF) = 6 Then Return True
EndFunc

Func FindDll($sDll)
    If MsgBox(4,'FullScreen Fix - Error',$sDll & '    Does not exist' & @CRLF & _
        '     Would you like to select the file manually?     ' & @CRLF & @CRLF) = 6 Then
        $sNewFileName = FileOpenDialog('Adobe FullScreen Fix', @SystemDir , 'Dll File (*.dll)' , 1 , 'NPSWF32.dll')
        If StringRight($sNewFileName,11) = "NPSWF32.DLL" Then
            Return True
        EndIf
    EndIf
    Return False
EndFunc

Func FileReadFail()
    FileOpenFail()
    Return False
EndFunc

Func FileWriteFail()
    FileOpenFail()  
    Return False
EndFunc
Link to comment
Share on other sites

Great idea, but i can't get it work with the newest Flash Version (10,0,2,54 - Shockwave Flash 10.0 r2)

It crashes (after 2 other Warnings) with

" The 2 bytes at location 0x136340 should be0x6A09,

however they are 0x0074

Critical failure...Exiting...."

Has anyone an idea how to fix that?

Your Spider

www.AutoIt.de - Moderator of the German AutoIt Forum

 

Link to comment
Share on other sites

Great idea, but i can't get it work with the newest Flash Version (10,0,2,54 - Shockwave Flash 10.0 r2)

It crashes (after 2 other Warnings) with

" The 2 bytes at location 0x136340 should be0x6A09,

however they are 0x0074

Critical failure...Exiting...."

Has anyone an idea how to fix that?

Your Spider

Yea just one, Update your flash to version 10.0.22.87

Then it will work

Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...

Here is a new version that will work with

flash version 10.0.22.87 (was only version to work)

or

flash version, 10.0.32.18 (most current version as of 11/11/09)

AdobeFix.au3

Global $debug = False
Global $ver
start()

Func start()    
    If Not FileExists(@SystemDir & '\Macromed\Flash\NPSWF32.dll') Then
        FindDll('NPSWF32.dll')
    Else
        VerifyDll(@SystemDir & '\Macromed\Flash\NPSWF32.dll')
    EndIf
EndFunc

Func VerifyDll($sDll)
    Local $sVer,$oFSO
    $oFSO = ObjCreate("Scripting.FileSystemObject")
    $sVer = $oFSO.GetFileVersion( $sDll )
    If $sVer <> '10.0.22.87' and $sVer <> '10.0.32.18' Then 
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Version <> 10.0.22.87' & @crlf);### Debug Console
        If Not WrongVersion($sVer,'10.0.22.87 or 10.0.32.18') Then
            $oFSO = ""
            Exit
        EndIf    
    EndIf
    If $sVer = '10.0.22.87' Then $ver = '2287'
    If $sVer = '10.0.32.18' Then $ver = '3218'
    $oFSO = ""
    Patchit($sDll)
EndFunc

Func Patchit($sDll)
    Local $hDLL, $bFile, $bReplace, $bReplacement, $bPart1, $bPart2, $bTarget
    $hDLL = FileOpen($sDll,16)
    If @error = -1 Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') File open (read binary mode) failed' & @crlf);### Debug Console
        FileOpenFail()
        Exit
    EndIf
    $bFile = FileRead($hDLL)
    If @error = 1 Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Read failed' & @crlf);### Debug Console
        FileReadFail()
        Exit
    EndIf    
    FileClose($hDLL)
    If $ver = '2287' Then
        If BinaryLen($bFile) <> 3771296 Then
            If Not WrongSize(BinaryLen($bFile),3771296) Then Exit
        EndIf
        $bPart1 = BinaryMid($bFile, 1, 1270591)
        $bTarget = BinaryMid($bFile, 1270592, 2)
        $bPart2 = BinaryMid($bFile, 1270594, BinaryLen($bFile))
    Else
        If BinaryLen($bFile) <> 3883424 Then
            If Not WrongSize(BinaryLen($bFile),3771296) Then Exit
        EndIf
        $bPart1 = BinaryMid($bFile, 1, 1274696)
        $bTarget = BinaryMid($bFile, 1274697, 2)
        $bPart2 = BinaryMid($bFile, 1274699, BinaryLen($bFile))
    EndIf
    If $bTarget = Binary("0x0074") Then
        $bTarget = Binary("0x00EB")
        $ReplacementMsg = '      0xEB Indicates that this file is not currently pathed.      ' & @CRLF & @CRLF & '      Would you like to patch it now?'
    ElseIf $bTarget = Binary("0x00EB") Then
        $bTarget = Binary("0x0074")
        $ReplacementMsg = '      0x74 Indicates that this file has been patched.      ' & @CRLF & @CRLF & '      Would you like to remove the patch?'
    Else
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Byte not match 74 or EB' & @crlf);### Debug Console
        BinNotMatch($bTarget,Binary("0x0074"))
        Exit
    EndIf
    
    $bReplace = $bPart1 & $bTarget & $bPart2    
    If BinaryLen($bReplace) <> BinaryLen($bFile) Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Replacment file length <> Original file length' & @crlf);### Debug Console
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $bFile = ' & BinaryLen($bFile) & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $bReplace = ' & BinaryLen($bReplace) & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
        
        MsgBox(0,'FullScreen Fix - Error','      Critical error: the length of the original file' & @CRLF & '      and the length of the new file would have not been the same.      ' & @CRLF & '      Commit changes to file has beeen aborted. ' & @CRLF & @CRLF & '      Uknown reason how or why this would happen. ' & @CRLF & @CRLF & '      Exiting....' & @CRLF)
        Exit
    EndIf
    If MsgBox(4,'FullScreen Fix - Patch','      Found the target dll file, ' & $sDll & '.' & @CRLF & @CRLF & _
        '      Location 0x136340 - 0x136341 equals 0x' & StringRight($bTarget,2) & @CRLF & @CRLF & $ReplacementMsg & @CRLF & @CRLF ) = 6 Then
        $hDLL = FileOpen($sDll,18)
        If @error = -1 Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') File open (binary overwrite mode) failed' & @crlf);### Debug Console
            FileOpenFail()
            Exit
        EndIf            
        If Not FileWrite($hDLL,$bReplace) Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') File write failed' & @crlf);### Debug Console
            FileClose($hDLL)
            FileWriteFail()
            Exit
        EndIf
        FileClose($hDLL)
    EndIf
    Exit    
EndFunc

Func BinNotMatch($bIs,$bShouldbe)
    MsgBox(0,'FullScreen Fix - Error','      The 2 bytes at location 0x136340/0x137349 should be' & $bShouldbe & ',      ' & @CRLF & '      however they are ' & $bIs & @CRLF & @CRLF & '       Critical failure...Exiting....'  & @CRLF)
    Return False
EndFunc

Func FileOpenFail()    
    MsgBox(0,'FullScreen Fix - Error','      Unable to open file, File may be in use.      ' & @CRLF & '      Try the following' & @CRLF & '        Quit any applications that maybe using flash.' & @CRLF & '        Restart your system.' & @CRLF & '        Use an account with administrator privledges.' & @CRLF & '        Check permissions to make sure you have read & write privledges.' & @CRLF & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
    Return False
EndFunc

Func WrongVersion($sVerIs, $sVerShouldBe)
    If MsgBox(4,'FullScreen Fix - Error','The dll file version should be' & $sVerShouldBe & ',' & @CRLF & "      however it returned a version of " & $sVerIs & @CRLF & "      It's possible this information is in error." & @CRLF & '      There are a number of additional checks to make sure the wrong file does not get patched      ' & @CRLF & @CRLF & '      Would you like to continue ?' & @CRLF & @CRLF) = 6 Then Return True
EndFunc

Func WrongSize($nSizeIs, $nSizeShouldBe)
    If MsgBox(4,'FullScreen Fix - Error', 'The dll file size should be' & $nSizeShouldBe & ',' & @CRLF & "however it is " & $nSizeIs & @CRLF & "It's possible the patch may work still." & @CRLF & 'There are a number of additional checks to make sure the wrong file does not get patched' & @CRLF & @CRLF & 'Would you like to continue ?' & @CRLF & @CRLF) = 6 Then Return True
EndFunc

Func FindDll($sDll)
    If MsgBox(4,'FullScreen Fix - Error',$sDll & '      Does not exist' & @CRLF & '      Would you like to select the file manually?      ' & @CRLF & @CRLF) = 6 Then
        $sNewFileName = FileOpenDialog('Adobe FullScreen Fix', @SystemDir , 'Dll File (*.dll)' , 1 , 'NPSWF32.dll')
        If StringRight($sNewFileName,11) = "NPSWF32.DLL" Then
            Return True
        EndIf
    EndIf
    Return False
EndFunc

Func FileReadFail()
    FileOpenFail()
    Return False
EndFunc

Func FileWriteFail()
    FileOpenFail()    
    Return False
EndFunc
Link to comment
Share on other sites

  • 1 month later...

Another new flash version, so now the script works with versions, 10.0.22.87, 10.0.32.18, or 10.0.42.34

AdobeFix.au3

Global $debug = False
Global $ver
start()

Func start()    
    If Not FileExists(@SystemDir & '\Macromed\Flash\NPSWF32.dll') Then
        FindDll('NPSWF32.dll')
    Else
        VerifyDll(@SystemDir & '\Macromed\Flash\NPSWF32.dll')
    EndIf
EndFunc

Func VerifyDll($sDll)
    Local $sVer,$oFSO
    $oFSO = ObjCreate("Scripting.FileSystemObject")
    $sVer = $oFSO.GetFileVersion( $sDll )
    If $sVer = '10.0.22.87' Then
        $ver = '2287'
    ElseIf $sVer = '10.0.32.18' Then
        $ver = '3218'
    ElseIf $sVer = '10.0.42.34' Then
        $ver = '4234'
    Else
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Version <> 10.0.22.87' & @crlf);### Debug Console
        If Not WrongVersion($sVer,'10.0.22.87, 10.0.32.18, or 10.0.42.34') Then
            $oFSO = ""
            Exit
        EndIf
        $ver = '4234'
    EndIf
    $oFSO = ""
    Openit($sDll)
EndFunc

Func Openit($sDll)
    Local $hDLL, $bFile
    $hDLL = FileOpen($sDll,16)
    If @error = -1 Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') File open (read binary mode) failed' & @crlf);### Debug Console
        FileOpenFail()
        Exit
    EndIf
    $bFile = FileRead($hDLL)
    If @error = 1 Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Read failed' & @crlf);### Debug Console
        FileReadFail()
        Exit
    EndIf    
    FileClose($hDLL)
    PatchIt($bFile,$sDll,'2287',3771296,1270591)
    PatchIt($bFile,$sDll,'3218',3883424,1274696)
    PatchIt($bFile,$sDll,'4234',3885984,1276282)
    Exit
EndFunc

Func PatchIt(byref $bFile,$sDll,$sV,$nL,$nO)
    If $ver <> $sV then return
    
    Local $bReplace, $bReplacement, $bPart1, $bPart2, $bTarget, $hDLL
    
    If BinaryLen($bFile) <> $nL Then
        If Not WrongSize(BinaryLen($bFile),$nL) Then Exit
    EndIf
    $bPart1 = BinaryMid($bFile, 1, $nO)
    $bTarget = BinaryMid($bFile, $nO + 1, 2)
    $bPart2 = BinaryMid($bFile, $nO + 3, BinaryLen($bFile))


   If $bTarget = Binary("0x0074") Then
        $bTarget = Binary("0x00EB")
        $ReplacementMsg = '      0xEB Indicates that this file is not currently pathed.      ' & @CRLF & @CRLF & '      Would you like to patch it now?'
    ElseIf $bTarget = Binary("0x00EB") Then
        $bTarget = Binary("0x0074")
        $ReplacementMsg = '      0x74 Indicates that this file has been patched.      ' & @CRLF & @CRLF & '      Would you like to remove the patch?'
    Else
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Byte not match 74 or EB' & @crlf);### Debug Console
        BinNotMatch($bTarget,Binary("0x0074"))
        Exit
    EndIf
    
    $bReplace = $bPart1 & $bTarget & $bPart2    
    If BinaryLen($bReplace) <> BinaryLen($bFile) Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') Replacment file length <> Original file length' & @crlf);### Debug Console
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $bFile = ' & BinaryLen($bFile) & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $bReplace = ' & BinaryLen($bReplace) & @crlf & '>Error code: ' & @error & @crlf);### Debug Console
        
        MsgBox(0,'FullScreen Fix - Error','      Critical error: the length of the original file' & @CRLF & '      and the length of the new file would have not been the same.      ' & @CRLF & '      Commit changes to file has beeen aborted. ' & @CRLF & @CRLF & '      Uknown reason how or why this would happen. ' & @CRLF & @CRLF & '      Exiting....' & @CRLF)
        Exit
    EndIf
    If MsgBox(4,'FullScreen Fix - Patch','      Found the target dll file, ' & $sDll & '.' & @CRLF & @CRLF & _
        '      The 2 target bytes equal 0x' & StringRight($bTarget,2) & @CRLF & @CRLF & $ReplacementMsg & @CRLF & @CRLF ) = 6 Then
        $hDLL = FileOpen($sDll,18)
        If @error = -1 Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') File open (binary overwrite mode) failed' & @crlf);### Debug Console
            FileOpenFail()
            Exit
        EndIf            
        If Not FileWrite($hDLL,$bReplace) Then
        If $debug Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') File write failed' & @crlf);### Debug Console
            FileClose($hDLL)
            FileWriteFail()
            Exit
        EndIf
        FileClose($hDLL)
    EndIf
    Exit
EndFunc

Func BinNotMatch($bIs,$bShouldbe)
    MsgBox(0,'FullScreen Fix - Error','      The 2 bytes at location 0x136340,0x137349,or 0x137979 should be' & $bShouldbe & ',      ' & @CRLF & '      however they are ' & $bIs & @CRLF & @CRLF & '       Critical failure...Exiting....'  & @CRLF)
    Return False
EndFunc

Func FileOpenFail()    
    MsgBox(0,'FullScreen Fix - Error','      Unable to open file, File may be in use.      ' & @CRLF & '      Try the following' & @CRLF & '        Quit any applications that maybe using flash.' & @CRLF & '        Restart your system.' & @CRLF & '        Use an account with administrator privledges.' & @CRLF & '        Check permissions to make sure you have read & write privledges.' & @CRLF & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
    Return False
EndFunc

Func WrongVersion($sVerIs, $sVerShouldBe)
    If MsgBox(4,'FullScreen Fix - Error','The dll file version should be' & $sVerShouldBe & ',' & @CRLF & "      however it returned a version of " & $sVerIs & @CRLF & "      It's possible this information is in error." & @CRLF & '      There are a number of additional checks to make sure the wrong file does not get patched      ' & @CRLF & @CRLF & '      Would you like to continue ?' & @CRLF & @CRLF) = 6 Then Return True
EndFunc

Func WrongSize($nSizeIs, $nSizeShouldBe)
    If MsgBox(4,'FullScreen Fix - Error', 'The dll file size should be' & $nSizeShouldBe & ',' & @CRLF & "however it is " & $nSizeIs & @CRLF & "It's possible the patch may work still." & @CRLF & 'There are a number of additional checks to make sure the wrong file does not get patched' & @CRLF & @CRLF & 'Would you like to continue ?' & @CRLF & @CRLF) = 6 Then Return True
EndFunc

Func FindDll($sDll)
    If MsgBox(4,'FullScreen Fix - Error',$sDll & '      Does not exist' & @CRLF & '      Would you like to select the file manually?      ' & @CRLF & @CRLF) = 6 Then
        $sNewFileName = FileOpenDialog('Adobe FullScreen Fix', @SystemDir , 'Dll File (*.dll)' , 1 , 'NPSWF32.dll')
        If StringRight($sNewFileName,11) = "NPSWF32.DLL" Then
            Return True
        EndIf
    EndIf
    Return False
EndFunc

Func FileReadFail()
    FileOpenFail()
    Return False
EndFunc

Func FileWriteFail()
    FileOpenFail()    
    Return False
EndFunc
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Quick fix so it works with the new version of flash 10.0.45.2 , the release candidate for 10.1 (10.1.53.74)

Plus just for bonus points, I added the one version of 10 I missed '10.0.12.36'

change lines 17 To 22

From

If $sVer = '10.0.22.87' Then
    $ver = '2287'
ElseIf $sVer = '10.0.32.18' Then
    $ver = '3218'
ElseIf $sVer = '10.0.42.34' Then

to

If $sVer = '10.0.12.36' Then
    $ver = '1236'
ElseIf $sVer = '10.0.22.87' Then
    $ver = '2287'
ElseIf $sVer = '10.0.32.18' Then
    $ver = '3218'
ElseIf $sVer = '10.0.42.34' Then
    $ver = '4234'
ElseIf $sVer = '10.0.45.2' Then
    $ver = '4520'
ElseIf $sVer = '10.1.53.74' Then
    $ver = '5370'

and change lines 50,51 & 52

From

PatchIt($bFile,$sDll,'2287',3771296,1270591)
PatchIt($bFile,$sDll,'3218',3883424,1274696)
PatchIt($bFile,$sDll,'4234',3885984,1276282)

To

PatchIt($bFile,$sDll,'1236',3695008,1271652)
PatchIt($bFile,$sDll,'2287',3771296,1270591)
PatchIt($bFile,$sDll,'3218',3883424,1274696)
PatchIt($bFile,$sDll,'4234',3885984,1276282)
PatchIt($bFile,$sDll,'4520',3884312,1277053)
PatchIt($bFile,$sDll,'5370',5603328,1624837)

AdobeFix.au3

Link to comment
Share on other sites

  • 2 months later...

Finally have a working script for version 10.1.53.64

Made it easier to add a new version.

Working on a function to find the correct location to patch in a unknown version.

Script can patch / remove patch for Flash versions

10.0.12.36

10.0.22.87

10.0.32.18

10.0.42.34

10.0.45.2 and

10.1.53.64

#cs
The scanforit function needs some work, I will improve it after I see
    how the next couple version affect the code.
The update to 10.1.53.64 Involved a new method patching the dll.
If that happens again the ability to possibly patch future untested versions won't have a
    chance in HE double hockey sticks of working.

To Add a version you need to increment the ubound of the 5 global const
    $vFlashVer[7] becomes $vFlashVer[8] 
    $vFlashSize[7] becomes $vFlashSize[8] etc...

And the New Version's data for all 5 const
    Don't forget the comma or 'Quotes' for string values

Global Const $vFlashVer[7]    = Version of the NPSWF32.dll
Global Const $vFlashSize[7]   = Size of the NPSWF32.dll file in bytes
Global Const $vFlashOffset[7] = Offset in bytes to location of bytes needing replacement
Global Const $vFlashOrig[7]   = Original bytes
Global Const $vFlashNew[7]    = Replacement Bytes
#ce

Global Const $vFlashVer[7]    = [ '10.0.12.36','10.0.22.87','10.0.32.18','10.0.42.34','10.0.45.2' ,'10.1.53.64']
Global Const $vFlashSize[7]   = [ 3695008, 3771296, 3883424, 3885984, 3884312, 5612496 ]
Global Const $vFlashOffset[7] = [ 1271652, 1270591, 1274696, 1276282, 1277053, 1575445 ]
Global Const $vFlashOrig[7]   = [ '0x0074', '0x0074', '0x0074', '0x0074', '0x0074', '0x7439' ]
Global Const $vFlashNew[7]    = [ '0x00EB', '0x00EB', '0x00EB', '0x00EB', '0x00EB', '0x9090' ]
Global $ver

start()

Func start()
    If Not FileExists(@SystemDir & '\Macromed\Flash\NPSWF32.dll') Then
        FindDll('NPSWF32.dll')
    Else
        VerifyDll(@SystemDir & '\Macromed\Flash\NPSWF32.dll')
    EndIf
EndFunc

Func VerifyDll($sDll)
    Local $sVer,$oFSO
    $oFSO = ObjCreate("Scripting.FileSystemObject")
    $sVer = $oFSO.GetFileVersion( $sDll )

    For $i = 0 To UBound($vFlashVer) - 1
        If $sVer = $vFlashVer[$i] Then
            $ver = $sVer
            ExitLoop
        EndIf
    Next
    $oFSO = ""
    If Not $ver Then
        If Not WrongVersion($sVer) Then
            ScanForIt($sDll, $sVer, Binary('0x743983E807741183E80575138B'),Binary('0x743983E807741183E80575138B'))
        Else
            Exit
        EndIf
    EndIf
    Openit($sDll)
EndFunc

Func Openit($sDll)
    Local $hDLL, $bFile
    $hDLL = FileOpen($sDll,16)
    If @error = -1 Then
        FileOpenFail()
        Exit
    EndIf
    $bFile = FileRead($hDLL)
    If @error = 1 Then
        FileReadFail()
        Exit
    EndIf
    FileClose($hDLL)
    For $i = 0 To UBound($vFlashVer) - 1
        PatchIt($bFile,$sDll,$vFlashVer[$i],$vFlashSize[$i],$vFlashOffset[$i],Binary($vFlashOrig[$i]),Binary($vFlashNew[$i]))
    Next
EndFunc

Func ScanForIt($sDll,$sVer,$bFind, $bFindPatched)
    Local $loc1,$loc2,$i,$nSize
    $ver = $sVer
    $nSize = FileGetSize($sDll)

    $hDLL = FileOpen($sDll,16)
    If @error Then
        FileOpenFail()
        Exit
    EndIf
    $bFile = FileRead($hDLL)
    If @error Then
        FileReadFail()
        Exit
    EndIf
    FileClose($hDLL)

    $loc1 = StringInStr(BinaryToString($bFile),BinaryToString($bFind),Default,1)
    If $loc1 Then
        ConsoleWrite('Location 1= ' & $loc1 & @CRLF)
        $sLocs = 'Location 1= ' & $loc1 & @CRLF
    Else
        $loc1 = StringInStr(BinaryToString($bFile),BinaryToString($bFindPatched),Default,1)
        If $loc1 Then
            If MsgBox(1,'FullScreen Fix : Untested Version',"      Found a 'possible' location where an untested version was patched    " & @CRLF & '      Version = ' & $ver & '      Location = ' & $loc1 & @CRLF & @CRLF & '      DO NOT proceed unless you have previously patched an untested version.      ' & @CRLF ) <> 1 Then
                Exit
            Else
                PatchIt($bFile,$sDll,$ver,$nSize,$loc1,Binary("0x7439"),Binary("0x9090"))
                Exit
            EndIf
        EndIf
        MsgBox(0,'FullScreen Fix - Error','      Unable to locate the correct byte sequence in the dll file       ' & @CRLF & '      Version = ' & $ver & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
        Exit
    EndIf


    $loc2 = StringInStr(BinaryToString($bFile),BinaryToString($bFind),Default,2)
    If $loc2 Then
        ConsoleWrite('Location 2= ' & $loc2 & @CRLF)
        $sLocs &= 'Location 2= ' & $loc2 & @CRLF
        $i = 3
        While True
            $p = StringInStr(BinaryToString($bFile),BinaryToString($bFind),Default,$i)
            If Not $p Then ExitLoop
            $sLocs &= 'Location ' & $i & '= ' & $p & @CRLF
            ConsoleWrite('Location ' & $i & '= ' & $p & @CRLF)
            $i += 1
            If $i > 20 Then ExitLoop
        WEnd
        ConsoleWrite($sLocs & @CRLF)
        MsgBox(0,'FullScreen Fix - Error','      Found multiple possible locations to patch      ' & @CRLF & '      Version = ' & $ver & @CRLF & $sLocs & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
        Exit
    Else
        MsgBox(0,'FullScreen Fix','      Scan Success found 1 possible location to patch.      ' & @CRLF & '      Version = ' & $ver & @CRLF & '      Location = ' & $loc1 & @CRLF & @CRLF )
        PatchIt($bFile,$sDll,$ver,$nSize,$loc1,Binary("0x7439"),Binary("0x9090"))
    EndIf
    Exit
EndFunc

Func PatchIt(byref $bFile,$sDll,$sV,$nL,$nO,$bOrig,$bNew)
    If $ver <> $sV then return

    Local $bReplace, $bReplacement, $bPart1, $bPart2, $bTarget, $hDLL

    If BinaryLen($bFile) <> $nL Then
        If Not WrongSize(BinaryLen($bFile),$nL) Then Exit
    EndIf
    $bPart1 = BinaryMid($bFile, 1, $nO)
    $bTarget = BinaryMid($bFile, $nO + 1, 2)
    $bPart2 = BinaryMid($bFile, $nO + 3, BinaryLen($bFile))

   If $bTarget = $bOrig Then
        $bTarget = $bNew
        $ReplacementMsg = '      ' & $bOrig & ' Indicates that this file is not currently pathed.      ' & @CRLF & @CRLF & '      Would you like to patch it now?'
    ElseIf $bTarget = $bNew Then
        $bTarget = $bOrig
        $ReplacementMsg = '      ' & $bNew & ' Indicates that this file has been patched.      ' & @CRLF & @CRLF & '      Would you like to remove the patch?'
    Else
        BinNotMatch($bTarget,$bOrig)
        Exit
    EndIf

    $bReplace = $bPart1 & $bTarget & $bPart2
    If BinaryLen($bReplace) <> BinaryLen($bFile) Then
        MsgBox(0,'FullScreen Fix - Error','      Critical error: the length of the original file' & @CRLF & '      and the length of the new file would have not been the same.      ' & @CRLF & '      Commit changes to file has beeen aborted. ' & @CRLF & @CRLF & '      Uknown reason how or why this would happen. ' & @CRLF & @CRLF & '      Exiting....' & @CRLF)
        Exit
    EndIf
    If MsgBox(4,'FullScreen Fix - Patch','      Found the target dll file, ' & $sDll & '.' & @CRLF & @CRLF & _
        @CRLF & $ReplacementMsg & @CRLF & @CRLF ) = 6 Then
        $hDLL = FileOpen($sDll,18)
        If @error = -1 Then
            FileOpenFail()
            Exit
        EndIf
        If Not FileWrite($hDLL,$bReplace) Then
            FileClose($hDLL)
            FileWriteFail()
            Exit
        EndIf
        FileClose($hDLL)
    EndIf
    Exit
EndFunc

Func BinNotMatch($bIs,$bShouldbe)
    MsgBox(0,'FullScreen Fix - Error','      The 2 bytes to patch are incorrect ' & $bShouldbe & ',      ' & @CRLF & '      they are ' & $bIs & @CRLF & @CRLF & '       Critical failure...Exiting....'  & @CRLF)
    Return False
EndFunc

Func FileOpenFail()
    MsgBox(0,'FullScreen Fix - Error','      Unable to open file, File may be in use.      ' & @CRLF & '      Try the following' & @CRLF & '        Quit any applications that maybe using flash.' & @CRLF & '        Restart your system.' & @CRLF & '        Use an account with administrator privledges.' & @CRLF & '        Check permissions to make sure you have read & write privledges.' & @CRLF & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
    Return False
EndFunc

Func WrongVersion($sVerIs)
    If MsgBox(4,'FullScreen Fix - Error', "     Current NPSWF32.dll Version = " & $sVerIs & @CRLF & "      That version hasn't been added yet"  & @CRLF & @CRLF & '      Would you like to scan the file for the target bytes ?' & @CRLF & @CRLF) = 6 Then Return True
    Exit
EndFunc

Func WrongSize($nSizeIs, $nSizeShouldBe)
    If MsgBox(4,'FullScreen Fix - Error', 'The dll file size should be' & $nSizeShouldBe & ',' & @CRLF & "however it is " & $nSizeIs & @CRLF & "It's possible the patch may work still." & @CRLF & 'There are a number of additional checks to make sure the wrong file does not get patched' & @CRLF & @CRLF & 'Would you like to continue ?' & @CRLF & @CRLF) = 6 Then Return True
EndFunc

Func FindDll($sDll)
    If MsgBox(4,'FullScreen Fix - Error',$sDll & '      Does not exist' & @CRLF & '      Would you like to select the file manually?      ' & @CRLF & @CRLF) = 6 Then
        $sNewFileName = FileOpenDialog('Adobe FullScreen Fix', @SystemDir , 'Dll File (*.dll)' , 1 , 'NPSWF32.dll')
        If StringRight($sNewFileName,11) = "NPSWF32.DLL" Then
            Return True
        EndIf
    EndIf
    Return False
EndFunc

Func FileReadFail()
    FileOpenFail()
    Return False
EndFunc

Func FileWriteFail()
    FileOpenFail()
    Return False
EndFunc

AdobeFix.au3

Link to comment
Share on other sites

Ola.

Finally have a working script for version 10.1.53.64

Thank you very much for this script! I really wanted to use my DualScreen setup to watch two simultaneous games in the World Cup, and your script came in very handy! I did, however have to fix a small bug for it to work on my Vista 64bits machine.

On Vista64, the DLL you're looking for is not located in the system directory (but in C:\Windows\SysWOW64\Macromed\Flash), and the script you provided DOES ask for an alternate location - but then discards it and does NOT continue to patch the file. So I fixed that.

Since I don't know how to upload attachments (registered just to post this), I'll just include the whole script:

#cs
The scanforit function needs some work, I will improve it after I see
    how the next couple version affect the code.
The update to 10.1.53.64 Invovled a new method pathching the dll.
If that happens again the ability to possibly patch future untested versions won't have a
    chance in HE double hockey sticks of working.

To Add a version you need to increment the ubound of the 5 global consts
    ie... $vFlashVer[7] becomes $vFlashVer[8]

And the New Version's data for each
    Don't forget the comma between or 'Quotes' for string values

Global Const $vFlashVer[7]    = Version of the NPSWF32.dll
Global Const $vFlashSize[7]   = Size of the NPSWF32.dll file in bytes
Global Const $vFlashOffset[7] = Offset in bytes to location of bytes needing replacement
Global Const $vFlashOrig[7]   = Original bytes
Global Const $vFlashNew[7]    = Replacement Bytes
#ce

Global Const $vFlashVer[7]    = [ '10.0.12.36','10.0.22.87','10.0.32.18','10.0.42.34','10.0.45.2' ,'10.1.53.64']
Global Const $vFlashSize[7]   = [ 3695008, 3771296, 3883424, 3885984, 3884312, 5612496 ]
Global Const $vFlashOffset[7] = [ 1271652, 1270591, 1274696, 1276282, 1277053, 1575445 ]
Global Const $vFlashOrig[7]   = [ '0x0074', '0x0074', '0x0074', '0x0074', '0x0074', '0x7439' ]
Global Const $vFlashNew[7]    = [ '0x00EB', '0x00EB', '0x00EB', '0x00EB', '0x00EB', '0x9090' ]


Global $ver

start()

Func start()
    If Not FileExists(@SystemDir & '\Macromed\Flash\NPSWF32.dll') Then
        VerifyDll(FindDll('NPSWF32.dll'))
    Else
        VerifyDll(@SystemDir & '\Macromed\Flash\NPSWF32.dll')
    EndIf
EndFunc

Func VerifyDll($sDll)
    Local $sVer,$oFSO
    $oFSO = ObjCreate("Scripting.FileSystemObject")
    $sVer = $oFSO.GetFileVersion( $sDll )

    For $i = 0 To UBound($vFlashVer) - 1
        If $sVer = $vFlashVer[$i] Then
            $ver = $sVer
            ExitLoop
        EndIf
    Next
    $oFSO = ""
    If Not $ver Then
        If Not WrongVersion($sVer) Then
            ScanForIt($sDll, $sVer, Binary('0x743983E807741183E80575138B'),Binary('0x743983E807741183E80575138B'))
        Else
            Exit
        EndIf
    EndIf
    Openit($sDll)
EndFunc

Func Openit($sDll)
    Local $hDLL, $bFile
    $hDLL = FileOpen($sDll,16)
    If @error = -1 Then
        FileOpenFail()
        Exit
    EndIf
    $bFile = FileRead($hDLL)
    If @error = 1 Then
        FileReadFail()
        Exit
    EndIf
    FileClose($hDLL)
    For $i = 0 To UBound($vFlashVer) - 1
        PatchIt($bFile,$sDll,$vFlashVer[$i],$vFlashSize[$i],$vFlashOffset[$i],Binary($vFlashOrig[$i]),Binary($vFlashNew[$i]))
    Next
EndFunc

Func ScanForIt($sDll,$sVer,$bFind, $bFindPatched)
    Local $loc1,$loc2,$i,$nSize
    $ver = $sVer
    $nSize = FileGetSize($sDll)

    $hDLL = FileOpen($sDll,16)
    If @error Then
        FileOpenFail()
        Exit
    EndIf
    $bFile = FileRead($hDLL)
    If @error Then
        FileReadFail()
        Exit
    EndIf
    FileClose($hDLL)

    $loc1 = StringInStr(BinaryToString($bFile),BinaryToString($bFind),Default,1)
    If $loc1 Then
        ConsoleWrite('Location 1= ' & $loc1 & @CRLF)
        $sLocs = 'Location 1= ' & $loc1 & @CRLF
    Else
        $loc1 = StringInStr(BinaryToString($bFile),BinaryToString($bFindPatched),Default,1)
        If $loc1 Then
            If MsgBox(1,'FullScreen Fix : Untested Version',"      Found a 'possible' location where an untested version was patched    " & @CRLF & '      Version = ' & $ver & '      Location = ' & $loc1 & @CRLF & @CRLF & '      DO NOT proceed unless you have previously patched an untested version.      ' & @CRLF ) <> 1 Then
                Exit
            Else
                PatchIt($bFile,$sDll,$ver,$nSize,$loc1,Binary("0x7439"),Binary("0x9090"))
                Exit
            EndIf
        EndIf
        MsgBox(0,'FullScreen Fix - Error','      Unable to locate the correct byte sequence in the dll file       ' & @CRLF & '      Version = ' & $ver & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
        Exit
    EndIf


    $loc2 = StringInStr(BinaryToString($bFile),BinaryToString($bFind),Default,2)
    If $loc2 Then
        ConsoleWrite('Location 2= ' & $loc2 & @CRLF)
        $sLocs &= 'Location 2= ' & $loc2 & @CRLF
        $i = 3
        While True
            $p = StringInStr(BinaryToString($bFile),BinaryToString($bFind),Default,$i)
            If Not $p Then ExitLoop
            $sLocs &= 'Location ' & $i & '= ' & $p & @CRLF
            ConsoleWrite('Location ' & $i & '= ' & $p & @CRLF)
            $i += 1
            If $i > 20 Then ExitLoop
        WEnd
        ConsoleWrite($sLocs & @CRLF)
        MsgBox(0,'FullScreen Fix - Error','      Found multiple possible locations to patch      ' & @CRLF & '      Version = ' & $ver & @CRLF & $sLocs & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
        Exit
    Else
        MsgBox(0,'FullScreen Fix','      Scan Success found 1 possible location to patch.      ' & @CRLF & '      Version = ' & $ver & @CRLF & '      Location = ' & $loc1 & @CRLF & @CRLF )
        PatchIt($bFile,$sDll,$ver,$nSize,$loc1,Binary("0x7439"),Binary("0x9090"))
    EndIf
    Exit
EndFunc

Func PatchIt(byref $bFile,$sDll,$sV,$nL,$nO,$bOrig,$bNew)
    If $ver <> $sV then return

    Local $bReplace, $bReplacement, $bPart1, $bPart2, $bTarget, $hDLL

    If BinaryLen($bFile) <> $nL Then
        If Not WrongSize(BinaryLen($bFile),$nL) Then Exit
    EndIf
    $bPart1 = BinaryMid($bFile, 1, $nO)
    $bTarget = BinaryMid($bFile, $nO + 1, 2)
    $bPart2 = BinaryMid($bFile, $nO + 3, BinaryLen($bFile))

   If $bTarget = $bOrig Then
        $bTarget = $bNew
        $ReplacementMsg = '      ' & $bOrig & ' Indicates that this file is not currently pathed.      ' & @CRLF & @CRLF & '      Would you like to patch it now?'
    ElseIf $bTarget = $bNew Then
        $bTarget = $bOrig
        $ReplacementMsg = '      ' & $bNew & ' Indicates that this file has been patched.      ' & @CRLF & @CRLF & '      Would you like to remove the patch?'
    Else
        BinNotMatch($bTarget,$bOrig)
        Exit
    EndIf

    $bReplace = $bPart1 & $bTarget & $bPart2
    If BinaryLen($bReplace) <> BinaryLen($bFile) Then
        MsgBox(0,'FullScreen Fix - Error','      Critical error: the length of the original file' & @CRLF & '      and the length of the new file would have not been the same.      ' & @CRLF & '      Commit changes to file has beeen aborted. ' & @CRLF & @CRLF & '      Uknown reason how or why this would happen. ' & @CRLF & @CRLF & '      Exiting....' & @CRLF)
        Exit
    EndIf
    If MsgBox(4,'FullScreen Fix - Patch','      Found the target dll file, ' & $sDll & '.' & @CRLF & @CRLF & _
        @CRLF & $ReplacementMsg & @CRLF & @CRLF ) = 6 Then
        $hDLL = FileOpen($sDll,18)
        If @error = -1 Then
            FileOpenFail()
            Exit
        EndIf
        If Not FileWrite($hDLL,$bReplace) Then
            FileClose($hDLL)
            FileWriteFail()
            Exit
        EndIf
        FileClose($hDLL)
    EndIf
    Exit
EndFunc

Func BinNotMatch($bIs,$bShouldbe)
    MsgBox(0,'FullScreen Fix - Error','      The 2 bytes to patch are incorrect ' & $bShouldbe & ',      ' & @CRLF & '      they are ' & $bIs & @CRLF & @CRLF & '       Critical failure...Exiting....'  & @CRLF)
    Return False
EndFunc

Func FileOpenFail()
    MsgBox(0,'FullScreen Fix - Error','      Unable to open file, File may be in use.      ' & @CRLF & '      Try the following' & @CRLF & '        Quit any applications that maybe using flash.' & @CRLF & '        Restart your system.' & @CRLF & '        Use an account with administrator privledges.' & @CRLF & '        Check permissions to make sure you have read & write privledges.' & @CRLF & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
    Return False
EndFunc

Func WrongVersion($sVerIs)
    If MsgBox(4,'FullScreen Fix - Error', "     Current NPSWF32.dll Version = " & $sVerIs & @CRLF & "      That version hasn't been added yet"  & @CRLF & @CRLF & '      Would you like to scan the file for the target bytes ?' & @CRLF & @CRLF) = 6 Then Return True
    Exit
EndFunc

Func WrongSize($nSizeIs, $nSizeShouldBe)
    If MsgBox(4,'FullScreen Fix - Error', 'The dll file size should be' & $nSizeShouldBe & ',' & @CRLF & "however it is " & $nSizeIs & @CRLF & "It's possible the patch may work still." & @CRLF & 'There are a number of additional checks to make sure the wrong file does not get patched' & @CRLF & @CRLF & 'Would you like to continue ?' & @CRLF & @CRLF) = 6 Then Return True
EndFunc

Func FindDll($sDll)
    If MsgBox(4,'FullScreen Fix - Error',$sDll & '      Does not exist' & @CRLF & '      Would you like to select the file manually?      ' & @CRLF & @CRLF) = 6 Then
        $sNewFileName = FileOpenDialog('Adobe FullScreen Fix', @SystemDir , 'Dll File (*.dll)' , 1 , 'NPSWF32.dll')
        If StringRight($sNewFileName,11) = "NPSWF32.DLL" Then
            Return $sNewFileName
        EndIf
    EndIf
    Return ""
EndFunc

Func FileReadFail()
    FileOpenFail()
    Return False
EndFunc

Func FileWriteFail()
    FileOpenFail()
    Return False
EndFunc
Link to comment
Share on other sites

In past versions of Flash, I've just used the hex editor method to patch the DLL. With the new version, though, I can't find the specific instructions to do so, and would love to just use this script... so, apologies for the painfully n00b question, but how does one run this script?

Link to comment
Share on other sites

Will be handy for me as I prefer to use my secondary monitor for video. Nice work.

Possibly worth adding that to display Flash in Firefox and similar browsers, you ONLY need NPSWF32.DLL. Also, you can put this directly into the browser's plugins folder, you don't actually need the Windows\...\Macromed folder.

Do remember that if you take this approach it won't auto-update though. But if you prefer to update manually or by script, it may be a better arrangement.

Link to comment
Share on other sites

  • 1 month later...

Hello again,

The script didn't update the 10.1.82.76 version, so I made some adjustments:

1. I have added (and tested) the 10.1.82.76 version to the script.

2. I have fixed the "search" function. This should ensure that any future Flash versions are also supported, provided the binary fingerprint we're looking for doesn't change.

3. It will now ask you if you want to run it as Administrator (this was required anyway)

4. I have added support for Vista64 bit. You no longer have to know where the NPSWF32.dll file is located.

Hope you like it (and that I didn't introduce any new bugs ;))

#cs
The scanforit function needs some work, I will improve it after I see
    how the next couple version affect the code.
The update to 10.1.53.64 Invovled a new method pathching the dll.
If that happens again the ability to possibly patch future untested versions won't have a
    chance in HE double hockey sticks of working.

To Add a version you need to increment the ubound of the 5 global consts
    ie... $vFlashVer[7] becomes $vFlashVer[8]

And the New Version's data for each
    Don't forget the comma between or 'Quotes' for string values

Global Const $vFlashVer[7]    = Version of the NPSWF32.dll
Global Const $vFlashSize[7]   = Size of the NPSWF32.dll file in bytes
Global Const $vFlashOffset[7] = Offset in bytes to location of bytes needing replacement
Global Const $vFlashOrig[7]   = Original bytes
Global Const $vFlashNew[7]    = Replacement Bytes
#ce
#RequireAdmin

Global Const $vFlashVer[7]    = [ '10.0.12.36','10.0.22.87','10.0.32.18','10.0.42.34','10.0.45.2' ,'10.1.53.64', '10.1.82.76' ]
Global Const $vFlashSize[7]   = [ 3695008, 3771296, 3883424, 3885984, 3884312, 5612496, 5969360 ]
Global Const $vFlashOffset[7] = [ 1271652, 1270591, 1274696, 1276282, 1277053, 1575445, 1575599 ]
Global Const $vFlashOrig[7]   = [ '0x0074', '0x0074', '0x0074', '0x0074', '0x0074', '0x7439', '0x7439' ]
Global Const $vFlashNew[7]    = [ '0x00EB', '0x00EB', '0x00EB', '0x00EB', '0x00EB', '0x9090', '0x9090' ]


Global $ver

start()

Func start()
    local $dir
    if FileExists(@WindowsDir & '\SysWOW64') Then
        $dir = @WindowsDir & '\SysWOW64'
    Else
        $dir = @SystemDir
    EndIf

    If Not FileExists($dir & '\Macromed\Flash\NPSWF32.dll') Then
        VerifyDll(FindDll('NPSWF32.dll'))
    Else
        VerifyDll($dir & '\Macromed\Flash\NPSWF32.dll')
    EndIf
EndFunc

Func VerifyDll($sDll)
    Local $sVer,$oFSO
    $oFSO = ObjCreate("Scripting.FileSystemObject")
    $sVer = $oFSO.GetFileVersion( $sDll )

    For $i = 0 To UBound($vFlashVer) - 1
        If $sVer = $vFlashVer[$i] Then
            $ver = $sVer
            ExitLoop
        EndIf
    Next
    $oFSO = ""
    If Not $ver Then
        If Not WrongVersion($sVer) Then
            ScanForIt($sDll, $sVer, Binary('0x743983E807741183E80575138B'),Binary('0x909083E807741183E80575138B'))
        Else
            Exit
        EndIf
    EndIf
    Openit($sDll)
EndFunc

Func Openit($sDll)
    Local $hDLL, $bFile
    $hDLL = FileOpen($sDll,16)
    If @error = -1 Then
        FileOpenFail()
        Exit
    EndIf
    $bFile = FileRead($hDLL)
    If @error = 1 Then
        FileReadFail()
        Exit
    EndIf
    FileClose($hDLL)
    For $i = 0 To UBound($vFlashVer) - 1
        PatchIt($bFile,$sDll,$vFlashVer[$i],$vFlashSize[$i],$vFlashOffset[$i],Binary($vFlashOrig[$i]),Binary($vFlashNew[$i]))
    Next
EndFunc

Func ScanForIt($sDll,$sVer,$bFind, $bFindPatched)
    Local $loc1,$loc2,$i,$nSize
    $ver = $sVer
    $nSize = FileGetSize($sDll)

    $hDLL = FileOpen($sDll,16)
    If @error Then
        FileOpenFail()
        Exit
    EndIf
    $bFile = FileRead($hDLL)
    If @error Then
        FileReadFail()
        Exit
    EndIf
    FileClose($hDLL)

    $loc1 = StringInStr(BinaryToString($bFile),BinaryToString($bFind),Default,1)
    If $loc1 Then
        $loc1 = $loc1 - 1  ; compensate for the fact that StringInStr returns an answer where '1' indicates the first location (instead of '0')
        
        ConsoleWrite('Location 1= ' & $loc1 & @CRLF)
        $sLocs = 'Location 1= ' & $loc1 & @CRLF
        If MsgBox(1,'FullScreen Fix : Untested Version',"      Found a possible location to patch this DLL    " & @CRLF & '      Version = ' & $ver & '      Location = ' & $loc1 & @CRLF & @CRLF & '      Would you like to apply the patch? ' & @CRLF ) <> 1 Then
            Exit
        Else
            PatchIt($bFile,$sDll,$ver,$nSize,$loc1,Binary("0x7439"),Binary("0x9090"))
            Exit
        EndIf

    Else
        $loc1 = StringInStr(BinaryToString($bFile),BinaryToString($bFindPatched),Default,1)
        If $loc1 Then
            $loc1 = $loc1 - 1 ; compensate for the fact that StringInStr returns an answer where '1' indicates the first location (instead of '0')
            If MsgBox(1,'FullScreen Fix : Untested Version',"      Found a 'possible' location where an untested version was patched    " & @CRLF & '      Version = ' & $ver & '      Location = ' & $loc1 & @CRLF & @CRLF & '      DO NOT proceed unless you have previously patched an untested version.      ' & @CRLF ) <> 1 Then
                Exit
            Else
                PatchIt($bFile,$sDll,$ver,$nSize,$loc1,Binary("0x7439"),Binary("0x9090"))
                Exit
            EndIf
        EndIf
        MsgBox(0,'FullScreen Fix - Error','      Unable to locate the correct byte sequence in the dll file       ' & @CRLF & '      Version = ' & $ver & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
        Exit
    EndIf


    $loc2 = StringInStr(BinaryToString($bFile),BinaryToString($bFind),Default,2)
    If $loc2 Then
        ConsoleWrite('Location 2= ' & $loc2 & @CRLF)
        $sLocs &= 'Location 2= ' & $loc2 & @CRLF
        $i = 3
        While True
            $p = StringInStr(BinaryToString($bFile),BinaryToString($bFind),Default,$i)
            If Not $p Then ExitLoop
            $sLocs &= 'Location ' & $i & '= ' & $p & @CRLF
            ConsoleWrite('Location ' & $i & '= ' & $p & @CRLF)
            $i += 1
            If $i > 20 Then ExitLoop
        WEnd
        ConsoleWrite($sLocs & @CRLF)
        MsgBox(0,'FullScreen Fix - Error','      Found multiple possible locations to patch      ' & @CRLF & '      Version = ' & $ver & @CRLF & $sLocs & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
        Exit
    Else
        MsgBox(0,'FullScreen Fix','      Scan Success found 1 possible location to patch.      ' & @CRLF & '      Version = ' & $ver & @CRLF & '      Location = ' & $loc1 & @CRLF & @CRLF )
        PatchIt($bFile,$sDll,$ver,$nSize,$loc1,Binary("0x7439"),Binary("0x9090"))
    EndIf
    Exit
EndFunc

Func PatchIt(byref $bFile,$sDll,$sV,$nL,$nO,$bOrig,$bNew)
    If $ver <> $sV then return

    Local $bReplace, $bReplacement, $bPart1, $bPart2, $bTarget, $hDLL

    If BinaryLen($bFile) <> $nL Then
        If Not WrongSize(BinaryLen($bFile),$nL) Then Exit
    EndIf
    $bPart1 = BinaryMid($bFile, 1, $nO)
    $bTarget = BinaryMid($bFile, $nO + 1, 2)
    $bPart2 = BinaryMid($bFile, $nO + 3, BinaryLen($bFile))

   If $bTarget = $bOrig Then
        $bTarget = $bNew
        $ReplacementMsg = '      ' & $bOrig & ' Indicates that this file is not currently pathed.      ' & @CRLF & @CRLF & '      Would you like to patch it now?'
    ElseIf $bTarget = $bNew Then
        $bTarget = $bOrig
        $ReplacementMsg = '      ' & $bNew & ' Indicates that this file has been patched.      ' & @CRLF & @CRLF & '      Would you like to remove the patch?'
    Else
        BinNotMatch($bTarget,$bOrig)
        Exit
    EndIf

    $bReplace = $bPart1 & $bTarget & $bPart2
    If BinaryLen($bReplace) <> BinaryLen($bFile) Then
        MsgBox(0,'FullScreen Fix - Error','      Critical error: the length of the original file' & @CRLF & '      and the length of the new file would have not been the same.      ' & @CRLF & '      Commit changes to file has beeen aborted. ' & @CRLF & @CRLF & '      Uknown reason how or why this would happen. ' & @CRLF & @CRLF & '      Exiting....' & @CRLF)
        Exit
    EndIf
    If MsgBox(4,'FullScreen Fix - Patch','      Found the target dll file, ' & $sDll & '.' & @CRLF & @CRLF & _
        @CRLF & $ReplacementMsg & @CRLF & @CRLF ) = 6 Then
        $hDLL = FileOpen($sDll,18)
        If @error = -1 Then
            FileOpenFail()
            Exit
        EndIf
        If Not FileWrite($hDLL,$bReplace) Then
            FileClose($hDLL)
            FileWriteFail()
            Exit
        EndIf
        FileClose($hDLL)
    EndIf
    Exit
EndFunc

Func BinNotMatch($bIs,$bShouldbe)
    MsgBox(0,'FullScreen Fix - Error','      The 2 bytes to patch are incorrect ' & $bShouldbe & ',      ' & @CRLF & '      they are ' & $bIs & @CRLF & @CRLF & '       Critical failure...Exiting....'  & @CRLF)
    Return False
EndFunc

Func FileOpenFail()
    MsgBox(0,'FullScreen Fix - Error','      Unable to open file, File may be in use.      ' & @CRLF & '      Try the following' & @CRLF & '        Quit any applications that maybe using flash.' & @CRLF & '        Restart your system.' & @CRLF & '        Use an account with administrator privledges.' & @CRLF & '        Check permissions to make sure you have read & write privledges.' & @CRLF & @CRLF & '      Critical failure...Exiting....'  & @CRLF & @CRLF)
    Return False
EndFunc

Func WrongVersion($sVerIs)
    local $yes
    $yes = MsgBox(4,'FullScreen Fix - Error', "     Current NPSWF32.dll Version = " & $sVerIs & @CRLF & "      That version hasn't been added yet"  & @CRLF & @CRLF & '      Would you like to scan the file for the target bytes ?' & @CRLF & @CRLF)
    
    #cs
    
    #ce
    Return ($yes = 7)
EndFunc

Func WrongSize($nSizeIs, $nSizeShouldBe)
    If MsgBox(4,'FullScreen Fix - Error', 'The dll file size should be' & $nSizeShouldBe & ',' & @CRLF & "however it is " & $nSizeIs & @CRLF & "It's possible the patch may work still." & @CRLF & 'There are a number of additional checks to make sure the wrong file does not get patched' & @CRLF & @CRLF & 'Would you like to continue ?' & @CRLF & @CRLF) = 6 Then Return True
EndFunc

Func FindDll($sDll)
    If MsgBox(4,'FullScreen Fix - Error',$sDll & '      Does not exist' & @CRLF & '      Would you like to select the file manually?      ' & @CRLF & @CRLF) = 6 Then
        $sNewFileName = FileOpenDialog('Adobe FullScreen Fix', @SystemDir , 'Dll File (*.dll)' , 1 , 'NPSWF32.dll')
        If StringRight($sNewFileName,11) = "NPSWF32.DLL" Then
            Return $sNewFileName
        EndIf
    EndIf
    Return ""
EndFunc

Func FileReadFail()
    FileOpenFail()
    Return False
EndFunc

Func FileWriteFail()
    FileOpenFail()
    Return False
EndFunc
Edited by devrandomness
Link to comment
Share on other sites

  • 1 month later...

Just replying to confirm the script also works with the new version of Flash (10.1.85.3) that was released recently. Probably that means it will work for some or most of the coming versions. Let's hope so! If it doesn't, I guess I'll revisit this page. But for now it seems to be 'case closed'. Hurrah! :-)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...