Aller au contenu

actaruss

INpactien
  • Compteur de contenus

    40
  • Inscription

  • Dernière visite

  • Jours gagnés

    1

actaruss's Achievements

Contributeur

Contributeur (5/14)

  • Reacting Well Rare
  • First Post Rare
  • Collaborator Rare
  • Week One Done
  • One Month Later

Recent Badges

  1. Non. Les précédentes évolutions de langue se sont faites progressivement, naturellement, sans être imposées puisqu'elles simplifiaient la langue, et permettaient de mieux coller au langage parlé. Ici c'est l'inverse : c'est imposé, artificiel, ça complexifie et ça dissocie l'écrit du parler. Et j'ai déjà répondu à cet argument dans mon premier message. Sinon erreur par inversion logique, ce n'est pas moi qui veut censurer l'inclusif de FF et TB, ce sont eux qui l'imposent de force alors que c'est illégitime (et illégal). Qu'ils fassent une version française normale, et une version française inclusive, qu'ils laissent le choix aux utilisateurs, et je n'aurai pas besoin d'écrire un tel script. https://www.upr.fr/allocutions/la-haute-trahison-du-traite-daix-la-chapelle-analyse-de-francois-asselineau/ Erreur par inversion logique : qui ne dit mot consent. Si tu ne combats pas un phénomène, tu l'acceptes. Il y a de nombreuses erreurs qui se sont infiltrées dans cette société par le laxisme, par le laisser-faire passif (militantisme LGBT, propagande sur la théorie du genre à l'école, etc.). Au contraire, faut se battre. En effet, après vérification, elle n'est pas présente dans toutes les versions. J'utilise la version de PortableApps sous Windows. Je n'utilise quasiment plus que des Apps portables pour éviter le Winrot. Et ma version portable a toutes les occurrences inclusives que j'ai citées dans le script.
  2. Au lieu du mot "modérer", tu devrais dire "censurer", et ajouter "parce que ça a choqué mon petit kokoro". Ce serait plus en en accord avec la réalité. Sinon les étiquettes "extrême droite" et "complotiste" sont des témoins de pensée paresseuse. C'est à ça qu'on reconnaît les moutons, les idiots utiles. Ah non ? Y'a pas d'écriture inclusive dans FF et TB ? Ah bah ! On se demande alors sur la base de quoi j'ai pu écrire autant de code, et sur quoi j'ai pu le tester ! Toi t'as l'air très connecté avec la réalité...
  3. L'écriture inclusive est véhiculée par des parasites de la société. C'est-à-dire des gens qui n'ont rien à faire de leur vie, ne savent rien faire, ne valent pas grand chose sur le marché du travail, donc qui ont le temps de rester chez eux devant leur PC. Comme le disait L33thium au-dessus, on n'en voit pas beaucoup des comme moi sur un forum, normal parce que j'ai une boite à faire tourner, donc je n'ai pas le temps pour ces conneries. Ces parasites ont du temps à perdre sur les réseaux sociaux, ou à modérer Wikipédia, ou à gangrénéer d'autres secteurs avec leurs contradictions internes. Donc ils n'ont que ça à faire de traduire des logiciels au lieu de chercher du boulot. Ils ne sont pas très intelligents, donc ils ne réfléchissent pas beaucoup, donc ils sont vulnérables à la propagande, donc ils tombent facilement dans les pièges du wokisme. ______________________ L'écriture inclusive est un projet plus grave quand on regarde ses sources de financement. L'identité nationale repose sur 3 piliers : - Langue - Race - Culture (qui elle-même dépend d'une histoire commune, l'histoire de France (qui elle-même dépend d'une religion commune, le christianisme)) Pour qu'un peuple soit uni, pour qu'un peuple ait une identité nationale, il faut toujours au moins 2 piliers forts. Tous les pays fonctionnent comme ça : 2 piliers forts et 1 faible, ou 3 forts. C'est ça qui donne sa puissance à un pays, pas le nombre d'individus. Exemple type de la Corée : 3 fois moins peuplée et 2 fois plus puissante que nous. La France est un cas particulier : du fait de son histoire, c'est l'un des très rares pays du monde dont le pilier faible est le pilier racial. C'est ça, la véritable "exception française". (Attention, je parle de pays, les USA ne sont pas un pays mais une fédération de plusieurs pays (Louisiane, Texas, etc.), autrement dit un empire) Tu peux considérer qu'un noir ou un arabe peuvent être français, un français n'est pas forcément blanc. Mais par exemple en Chine, pour eux c'est inimaginable : si tu n'as pas une tête de chinois t'es pas chinois. Et c'est pareil dans quasiment tous les pays du monde. L'État Profond des USA a un objectif d'asservissement de la population, l'Union Européenne a d'ailleurs été créée pour ce projet. Il s'agit de détruire les États-Nation pour les transformer en euro-régions faciles à asservir, avec une population esclavagisée, manipulée par la propagande, pauvre, stupide, ignorante et réduite. Pour détruire nos États-Nation, ils s'attaquent donc à ces 3 piliers. C'est par exemple pour cela que Georges Soros et toutes les structures de l'État Profond (Rothschild, Bill Gates, etc.) financent l'immigration. À la fois pour avoir des esclaves bon marché (nouvelle traite des noirs) et faire chuter le salaire des ouvriers, et à la fois pour détruire l'identité nationale. C'est pour cela que l'émigration est toujours extra-européenne (pas d'histoire commune), non-chrétienne (pas de religion commune), non blanche (pas de race commune), et masculine (il faut des bras pour travailler). C'est pour cela que les esclavagistes de SOS méditerranée ne te ramène jamais des femmes chrétiennes d'Orient, ils vont chercher des hommes noirs musulmans d'Érythrée jusqu'en Libye. C'est pour cela qu'on te serre toujours des photos d'un homme noir avec une femme blanche dans les médias, jamais l'inverse. Reste le pilier de la langue. C'est encore le plus fort en France : si tu ne parles pas français t'es pas français. Donc il faut détruire la langue française. Cela passe par 3 mesures : 1 - Destruction volontaire de l'apprentissage du français à l'éducation nationale, aujourd'hui plus de la moitié des élèves qui sortent du Lycée en France sont illettrés (quand 99% des élèves étaient lettrés à 11 ans dans les années 1960), ce n'est pas un hasard ou de l'incompétence, c'est un sabotage voulu et organisé. 2 - Promotion des langues régionales sur le français, pour saborder l'unité nationale, là encore suffit de regarder les sources de financements des organismes qui promeuvent ces langues régionales (discours d'Obama à Aix-la-Chapelle, il était juste ahurissant). 3 - Écriture inclusive, là encore quand tu remontes la pistes du fric, tu tombes sur les mêmes sources de financement. Résister à l'écriture inclusive est donc un devoir patriotique. ______________________ Pour Thunderbird, je l'utilise car je n'aime pas laisser mes emails en ligne. Après j'ai un serveur avec plusieurs couples de disque RAID 1 en ReFS. Donc pas vraiment de risque de perte de données. Et même en laissant les données en IMAP sur le serveur mail, c'est pratique pour centraliser plusieurs adresses mail. J'ai pris l'habitude de l'utiliser dans mes jeunes années et je l'aime bien, je trouve que sa structure est simple et élégante. Après j'espère que la Fondation Woke-Mozilla ne va pas commencer à saloper le code avec ses maladies mentales, les gens déstructurés font rarement de bons programmeurs. Pour Firefox, je suis obligé de l'utiliser car il m'arrive d'aller sur des sites optimisés pour lui. Même si je préfère Brave, je n'ai pas trop le choix. Merci BEAUCOUP pour ton extension, je ne l'avais pas vue, best add-on ever.
  4. Récemment, j'ai réalisé que cette immonde écriture inclusive était revenue dans Firefox et Thunderbird. J'ai donc réexécuté mes scripts de désinfection, mais ils ne fonctionnaient plus. Cela signifie 2 choses : 1 - Les traducteurs ne sont pas allés voir un psychiatre, comme je le leur avait pourtant conseillé. Je leur ai bien expliqué leur maladie mentale ci-dessus, mais bon, c'est le principe de la folie : on ne sait pas qu'on est fou. Laissons donc ces déchets de l'humanité rater leur vie et finir dans la poubelle de la sélection naturelle. 2 - Je n'aurais pas dû laisser ce code à ChatGPT. C'était de la flemme, et ce n'est jamais une bonne chose. J'ai donc regardé de près de code que ChatGPT avait pondu et en effet... c'est du code dégueulasse. Je m'en excuse. On en parle beaucoup, mais quand on y regarde de près, même la version 4.0 de ChatGPT ne semble pas très efficace pour coder. ChatGPT est utile pour "pisser" du code simple en grosse quantité, genre pour faire un site Internet vite fait. Mais dès qu'il s'agit d'un code complexe, pour l'instant l'intelligence artificielle est plus de la bêtise artificielle. J'ai donc pris une journée pour faire un vrai code potable. Voici donc un nouveau code. Cette fois c'est le même pour Firefox et Thunderbird, seule l'entête change. De plus, vous pouvez ajouter autant de lignes à modifier que vous voulez, et pas besoin qu'elles soient dans l'ordre ou présentes dans le fichier à modifier. C'était légèrement plus complexe à coder, mais cette fois ce code ne deviendra pas obsolète. Thunderbird en Powershell : # Character encoding = UTF-16 LE (Byte Order Mark = FF FE) # End-of-line = Windows (CR LF) # Composants requis : $current_folder = $PWD.Path # _____________________________________________________________________________ # Partie à modifier pour ajouter des fichiers et erreurs à corriger : # Emplacement personnalisé du dossier contenant le fichier "thunderbird.exe". # Vous pouvez le laisser vide. Exemple : # $program_folder = "$current_folder\Mozilla Thunderbird" $program_folder = "" # Emplacements connus : $program_folder_portable_32 = "$current_folder\App\Thunderbird" $program_folder_portable_64 = "$current_folder\App\Thunderbird64" $program_folder_installed_32 = "${env:ProgramFiles(x86)}\Mozilla Thunderbird" $program_folder_installed_64 = "${$env:ProgramFiles}\Mozilla Thunderbird" # Fichier(s) à réparer : $corrupted_file_1 = "omni.ja" # Réparations à faire : $corrupted_file_1_error_ori = @() $corrupted_file_1_error_fix = @() # away=absent·e => away=absent $corrupted_file_1_error_ori += "6E74C2B7650A" # nt·e $corrupted_file_1_error_fix += "6E740A0A0A0A" # nt # utilisateur·trice => utilisateur $corrupted_file_1_error_ori += "C2B774726963650A" # ·trice $corrupted_file_1_error_fix += "0A0A0A0A0A0A0A0A" # # Jean·ne Dupont => Jean Dupont $corrupted_file_1_error_ori += "C2B76E65204475706F6E740A" # ·ne Dupont $corrupted_file_1_error_fix += "204475706F6E740A0A0A0A0A" # Dupont # jean.ne.dupont@example.com => jean.dupont@exemple.com $corrupted_file_1_error_ori += "2E6E652E6475706F6E74406578616D706C652E636F6D0A" # .ne.dupont@example.com $corrupted_file_1_error_fix += "2E6475706F6E74406578656D706C652E636F6D0A0A0A0A" # .dupont@exemple.com # averti·e lorsque la génération de clé sera terminée. => averti lorsque la génération de clé sera terminée. $corrupted_file_1_error_ori += "C2B765206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A" # ·e lorsque la génération de clé sera terminée. $corrupted_file_1_error_fix += "206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A0A0A0A" # lorsque la génération de clé sera terminée. # satisfait·e du résultat. => satisfait du résultat. $corrupted_file_1_error_ori += "C2B7652064752072C3A973756C7461742E0A" # ·e du résultat. $corrupted_file_1_error_fix += "2064752072C3A973756C7461742E0A0A0A0A" # du résultat. # connecté·e plusieurs fois, une autre session peut avoir reçu le message. => connecté plusieurs fois, une autre session peut avoir reçu le message. $corrupted_file_1_error_ori += "C2B76520706C7573696575727320666F69732C20756E652061757472652073657373696F6E20706575742061766F6972207265C3A775206C65206D6573736167652E0A" # ·e plusieurs fois, une autre session peut avoir reçu le message. $corrupted_file_1_error_fix += "20706C7573696575727320666F69732C20756E652061757472652073657373696F6E20706575742061766F6972207265C3A775206C65206D6573736167652E0A0A0A0A" # plusieurs fois, une autre session peut avoir reçu le message. # pisté·e => pisté $corrupted_file_1_error_ori += "C3A9C2B7650A" # é·e $corrupted_file_1_error_fix += "C3A90A0A0A0A" # é # _____________________________________________________________________________ # Partie à ne pas modifier : function i_my_replace_array_hex_strings_in_file([string[]]$array_hex_strings_to_find, [string[]]$array_hex_strings_to_replace, [string]$file_fullname) { if ($array_hex_strings_to_find.GetUpperBound(0) -ne $array_hex_strings_to_replace.GetUpperBound(0)) { Write-Host "Erreur :`r`nLe nombre de cases dans le tableau des chaînes hexadécimales à détecter ($($array_hex_strings_to_find.GetUpperBound(0) + 1))`r`net dans le tableau des chaînes hexadécimales à remplacer ($($array_hex_strings_to_replace.GetUpperBound(0) + 1))`r`nn'est pas identique." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) # Si le buffer n'est pas vide, au cas où une touche aurait déjà été pressée. { while ($Host.UI.RawUI.KeyAvailable -eq $true) # Vide le buffer et met en pause. { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") # Met en pause. } exit 0 } for ($i = 0; $i -le $array_hex_strings_to_find.GetUpperBound(0); $i++) { if ($array_hex_strings_to_find[$i].Length -ne $array_hex_strings_to_replace[$i].Length) { Write-Host "Erreur :`r`nLa variable $($array_hex_strings_to_find[$i]) et`r`nla variable $($array_hex_strings_to_replace[$i])" Write-Host "n'ont pas le même nombre de caractères ($($array_hex_strings_to_find[$i].Length) contre $($array_hex_strings_to_replace[$i].Length))." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } if ($array_hex_strings_to_find[$i].Length % 2 -ne 0) { Write-Host "Erreur, les variables :`r`n$($array_hex_strings_to_find[$i]) et`r`n$($array_hex_strings_to_replace[$i])`r`nont un nombre impair de caractères." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } if ($array_hex_strings_to_find[$i].Length -lt 12) { Write-Host "Erreur, les variables :`r`n$($array_hex_strings_to_find[$i]) et`r`n$($array_hex_strings_to_replace[$i])" Write-Host "doivent avoir au moins 12 caractères hexadécimaux pour représenter" Write-Host "au moins 6 octets. Or ici, elles n'en contiennent que $($array_hex_strings_to_find[$i].Length)." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } } Out-File -FilePath "$file_fullname.temporary" -Force -Encoding ASCII # (Force = Écraser si existe déjà) (Encoding ASCII = Utiliser ASCII au lieu d'Unicode UTF16LE donc pas de Byte Order Mark FFFE) if ((Test-Path "$file_fullname.temporary") -eq $false) { Write-Host "Erreur, le fichier :`r`n$file_fullname.temporary" Write-Host "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } # Pour aller plus vite, on crée 5 tableaux en 2 dimensions. # Nous sommes obligés de créer chaque dimension indépendamment car # il est impossible de redimensionner dynamiquement les 2 dimensions. # Concernant la 1ère dimension : # Le 1er tableau contiendra les premiers octets de toutes les chaînes # à rechercher, convertis en décimal et en éliminant les doublons. # Le 2ème tableau contiendra les deuxièmes octets, etc. # Le 3ème tableau contiendra les troisièmes octets, etc. $array_bytes_to_find_1 = @() $array_bytes_to_find_2 = @() $array_bytes_to_find_3 = @() $array_bytes_to_find_4 = @() $array_bytes_to_find_5 = @() for ($i_1 = 0; $i_1 -le $array_hex_strings_to_find.GetUpperBound(0); $i_1++) { $b_already_exists = $false for ($i_2 = 0; $i_2 -le $array_bytes_to_find_1.GetUpperBound(0); $i_2++) { if ([Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(0, 2), 16) -eq $array_bytes_to_find_1[$i_2]) { $b_already_exists = $true } } if ($b_already_exists -eq $false) { $array_bytes_to_find_1 += [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(0, 2), 16) } $b_already_exists = $false for ($i_2 = 0; $i_2 -le $array_bytes_to_find_2.GetUpperBound(0); $i_2++) { if ([Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(2, 2), 16) -eq $array_bytes_to_find_2[$i_2]) { $b_already_exists = $true } } if ($b_already_exists -eq $false) { $array_bytes_to_find_2 += [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(2, 2), 16) } $b_already_exists = $false for ($i_2 = 0; $i_2 -le $array_bytes_to_find_3.GetUpperBound(0); $i_2++) { if ([Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(4, 2), 16) -eq $array_bytes_to_find_3[$i_2]) { $b_already_exists = $true } } if ($b_already_exists -eq $false) { $array_bytes_to_find_3 += [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(4, 2), 16) } $b_already_exists = $false for ($i_2 = 0; $i_2 -le $array_bytes_to_find_4.GetUpperBound(0); $i_2++) { if ([Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(6, 2), 16) -eq $array_bytes_to_find_4[$i_2]) { $b_already_exists = $true } } if ($b_already_exists -eq $false) { $array_bytes_to_find_4 += [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(6, 2), 16) } $b_already_exists = $false for ($i_2 = 0; $i_2 -le $array_bytes_to_find_5.GetUpperBound(0); $i_2++) { if ([Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(8, 2), 16) -eq $array_bytes_to_find_5[$i_2]) { $b_already_exists = $true } } if ($b_already_exists -eq $false) { $array_bytes_to_find_5 += [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(8, 2), 16) } } # Concernant la 2ème dimension : # Pour chaque tableau, elle contiendra les numéros des chaînes # auxquelles les octets correspondent (en commençant par 0). # Imaginons que la 1ère case du 1er tableau contient l'octet C2 = 194 # et que plusieurs chaînes commencent par C2 (doublons), par exemple # les chaînes 1 2 4 5 6, alors les chiffres 0 1 3 4 5 seront inscrits # dans la 2ème dimension de la 1ère case du 1er tableau. $array_bytes_to_find_1_2D = New-Object 'object[,]' ($array_bytes_to_find_1.GetUpperBound(0) + 1), 1 $array_bytes_to_find_2_2D = New-Object 'object[,]' ($array_bytes_to_find_2.GetUpperBound(0) + 1), 1 $array_bytes_to_find_3_2D = New-Object 'object[,]' ($array_bytes_to_find_3.GetUpperBound(0) + 1), 1 $array_bytes_to_find_4_2D = New-Object 'object[,]' ($array_bytes_to_find_4.GetUpperBound(0) + 1), 1 $array_bytes_to_find_5_2D = New-Object 'object[,]' ($array_bytes_to_find_5.GetUpperBound(0) + 1), 1 for ($i_1 = 0; $i_1 -le $array_bytes_to_find_1_2D.GetUpperBound(0); $i_1++) { $array_bytes_to_find_1_2D[$i_1, 0] = $array_bytes_to_find_1[$i_1] $i_2 = 1 for ($i_3 = 0; $i_3 -le $array_hex_strings_to_find.GetUpperBound(0); $i_3++) { if ([int]::Parse($array_hex_strings_to_find[$i_3].Substring(0, 2), [System.Globalization.NumberStyles]::HexNumber) -eq $array_bytes_to_find_1_2D[$i_1, 0]) { if ($array_bytes_to_find_1_2D.GetUpperBound(1) -lt $i_2) { # En PowerShell il n'existe pas d'équivalent à la commande # ReDim Preserve array_bytes_to_find_1_2D(ubound,ubound+1) # du VBScript pour redimensionner la 2ème dimension du tableau. # La notation "+=" ajoute un élément à la fin d'un tableau, # mais seulement s'il est en 1 dimension, pas en 2 dimensions. # Il faut donc créer un autre tableau $array_subarray_2D # avec une case supplémentaire puis recopier le tableau dedans # en utilisant une boucle for. $array_subarray_2D = New-Object 'object[,]' ($array_bytes_to_find_1_2D.GetUpperBound(0) + 1), ($array_bytes_to_find_1_2D.GetUpperBound(1) + 2) for ($i = 0; $i -le $array_bytes_to_find_1_2D.GetUpperBound(0); $i++) { for ($j = 0; $j -le $array_bytes_to_find_1_2D.GetUpperBound(1); $j++) { $array_subarray_2D[$i, $j] = $array_bytes_to_find_1_2D[$i, $j] } } $array_bytes_to_find_1_2D = $array_subarray_2D Remove-Variable -Name array_subarray_2D } $array_bytes_to_find_1_2D[$i_1, $i_2] = $i_3 $i_2++ } } } for ($i_1 = 0; $i_1 -le $array_bytes_to_find_2_2D.GetUpperBound(0); $i_1++) { $array_bytes_to_find_2_2D[$i_1, 0] = $array_bytes_to_find_2[$i_1] $i_2 = 1 for ($i_3 = 0; $i_3 -le $array_hex_strings_to_find.GetUpperBound(0); $i_3++) { if ([int]::Parse($array_hex_strings_to_find[$i_3].Substring(2, 2), [System.Globalization.NumberStyles]::HexNumber) -eq $array_bytes_to_find_2_2D[$i_1, 0]) { if ($array_bytes_to_find_2_2D.GetUpperBound(1) -lt $i_2) { $array_subarray_2D = New-Object 'object[,]' ($array_bytes_to_find_2_2D.GetUpperBound(0) + 1), ($array_bytes_to_find_2_2D.GetUpperBound(1) + 2) for ($i = 0; $i -le $array_bytes_to_find_2_2D.GetUpperBound(0); $i++) { for ($j = 0; $j -le $array_bytes_to_find_2_2D.GetUpperBound(1); $j++) { $array_subarray_2D[$i, $j] = $array_bytes_to_find_2_2D[$i, $j] } } $array_bytes_to_find_2_2D = $array_subarray_2D Remove-Variable -Name array_subarray_2D } $array_bytes_to_find_2_2D[$i_1, $i_2] = $i_3 $i_2++ } } } for ($i_1 = 0; $i_1 -le $array_bytes_to_find_3_2D.GetUpperBound(0); $i_1++) { $array_bytes_to_find_3_2D[$i_1, 0] = $array_bytes_to_find_3[$i_1] $i_2 = 1 for ($i_3 = 0; $i_3 -le $array_hex_strings_to_find.GetUpperBound(0); $i_3++) { if ([int]::Parse($array_hex_strings_to_find[$i_3].Substring(4, 2), [System.Globalization.NumberStyles]::HexNumber) -eq $array_bytes_to_find_3_2D[$i_1, 0]) { if ($array_bytes_to_find_3_2D.GetUpperBound(1) -lt $i_2) { $array_subarray_2D = New-Object 'object[,]' ($array_bytes_to_find_3_2D.GetUpperBound(0) + 1), ($array_bytes_to_find_3_2D.GetUpperBound(1) + 2) for ($i = 0; $i -le $array_bytes_to_find_3_2D.GetUpperBound(0); $i++) { for ($j = 0; $j -le $array_bytes_to_find_3_2D.GetUpperBound(1); $j++) { $array_subarray_2D[$i, $j] = $array_bytes_to_find_3_2D[$i, $j] } } $array_bytes_to_find_3_2D = $array_subarray_2D Remove-Variable -Name array_subarray_2D } $array_bytes_to_find_3_2D[$i_1, $i_2] = $i_3 $i_2++ } } } for ($i_1 = 0; $i_1 -le $array_bytes_to_find_4_2D.GetUpperBound(0); $i_1++) { $array_bytes_to_find_4_2D[$i_1, 0] = $array_bytes_to_find_4[$i_1] $i_2 = 1 for ($i_3 = 0; $i_3 -le $array_hex_strings_to_find.GetUpperBound(0); $i_3++) { if ([int]::Parse($array_hex_strings_to_find[$i_3].Substring(6, 2), [System.Globalization.NumberStyles]::HexNumber) -eq $array_bytes_to_find_4_2D[$i_1, 0]) { if ($array_bytes_to_find_4_2D.GetUpperBound(1) -lt $i_2) { $array_subarray_2D = New-Object 'object[,]' ($array_bytes_to_find_4_2D.GetUpperBound(0) + 1), ($array_bytes_to_find_4_2D.GetUpperBound(1) + 2) for ($i = 0; $i -le $array_bytes_to_find_4_2D.GetUpperBound(0); $i++) { for ($j = 0; $j -le $array_bytes_to_find_4_2D.GetUpperBound(1); $j++) { $array_subarray_2D[$i, $j] = $array_bytes_to_find_4_2D[$i, $j] } } $array_bytes_to_find_4_2D = $array_subarray_2D Remove-Variable -Name array_subarray_2D } $array_bytes_to_find_4_2D[$i_1, $i_2] = $i_3 $i_2++ } } } for ($i_1 = 0; $i_1 -le $array_bytes_to_find_5_2D.GetUpperBound(0); $i_1++) { $array_bytes_to_find_5_2D[$i_1, 0] = $array_bytes_to_find_5[$i_1] $i_2 = 1 for ($i_3 = 0; $i_3 -le $array_hex_strings_to_find.GetUpperBound(0); $i_3++) { if ([int]::Parse($array_hex_strings_to_find[$i_3].Substring(8, 2), [System.Globalization.NumberStyles]::HexNumber) -eq $array_bytes_to_find_5_2D[$i_1, 0]) { if ($array_bytes_to_find_5_2D.GetUpperBound(1) -lt $i_2) { $array_subarray_2D = New-Object 'object[,]' ($array_bytes_to_find_5_2D.GetUpperBound(0) + 1), ($array_bytes_to_find_5_2D.GetUpperBound(1) + 2) for ($i = 0; $i -le $array_bytes_to_find_5_2D.GetUpperBound(0); $i++) { for ($j = 0; $j -le $array_bytes_to_find_5_2D.GetUpperBound(1); $j++) { $array_subarray_2D[$i, $j] = $array_bytes_to_find_5_2D[$i, $j] } } $array_bytes_to_find_5_2D = $array_subarray_2D Remove-Variable -Name array_subarray_2D } $array_bytes_to_find_5_2D[$i_1, $i_2] = $i_3 $i_2++ } } } <# Write-Host "1ers octets à rechercher => Dans les chaînes : " for ($i_1 = 0; $i_1 -le $array_bytes_to_find_1_2D.GetUpperBound(0); $i_1++) { Write-Host -NoNewline "$($array_bytes_to_find_1_2D[$i_1, 0]) => " for ($i_2 = 1; $i_2 -le ($array_bytes_to_find_1_2D.GetUpperBound(1)); $i_2++) { Write-Host -NoNewline "$($array_bytes_to_find_1_2D[$i_1, $i_2])" if ($i_2 + 1 -le $array_bytes_to_find_1_2D.GetUpperBound(1)) { if ($array_bytes_to_find_1_2D[$i_1, $($i_2 + 1)] -ne $null) { Write-Host -NoNewline " " } } } Write-Host } Write-Host "2èmes octets à rechercher => Dans les chaînes : " for ($i_1 = 0; $i_1 -le $array_bytes_to_find_2_2D.GetUpperBound(0); $i_1++) { Write-Host -NoNewline "$($array_bytes_to_find_2_2D[$i_1, 0]) => " for ($i_2 = 1; $i_2 -le ($array_bytes_to_find_2_2D.GetUpperBound(1)); $i_2++) { Write-Host -NoNewline "$($array_bytes_to_find_2_2D[$i_1, $i_2])" if ($i_2 + 1 -le $array_bytes_to_find_2_2D.GetUpperBound(1)) { if ($array_bytes_to_find_2_2D[$i_1, $($i_2 + 1)] -ne $null) { Write-Host -NoNewline " " } } } Write-Host } Write-Host "3èmes octets à rechercher => Dans les chaînes : " for ($i_1 = 0; $i_1 -le $array_bytes_to_find_3_2D.GetUpperBound(0); $i_1++) { Write-Host -NoNewline "$($array_bytes_to_find_3_2D[$i_1, 0]) => " for ($i_2 = 1; $i_2 -le ($array_bytes_to_find_3_2D.GetUpperBound(1)); $i_2++) { Write-Host -NoNewline "$($array_bytes_to_find_3_2D[$i_1, $i_2])" if ($i_2 + 1 -le $array_bytes_to_find_3_2D.GetUpperBound(1)) { if ($array_bytes_to_find_3_2D[$i_1, $($i_2 + 1)] -ne $null) { Write-Host -NoNewline " " } } } Write-Host } Write-Host "4èmes octets à rechercher => Dans les chaînes : " for ($i_1 = 0; $i_1 -le $array_bytes_to_find_4_2D.GetUpperBound(0); $i_1++) { Write-Host -NoNewline "$($array_bytes_to_find_4_2D[$i_1, 0]) => " for ($i_2 = 1; $i_2 -le ($array_bytes_to_find_4_2D.GetUpperBound(1)); $i_2++) { Write-Host -NoNewline "$($array_bytes_to_find_4_2D[$i_1, $i_2])" if ($i_2 + 1 -le $array_bytes_to_find_4_2D.GetUpperBound(1)) { if ($array_bytes_to_find_4_2D[$i_1, $($i_2 + 1)] -ne $null) { Write-Host -NoNewline " " } } } Write-Host } Write-Host "5èmes octets à rechercher => Dans les chaînes : " for ($i_1 = 0; $i_1 -le $array_bytes_to_find_5_2D.GetUpperBound(0); $i_1++) { Write-Host -NoNewline "$($array_bytes_to_find_5_2D[$i_1, 0]) => " for ($i_2 = 1; $i_2 -le ($array_bytes_to_find_5_2D.GetUpperBound(1)); $i_2++) { Write-Host -NoNewline "$($array_bytes_to_find_5_2D[$i_1, $i_2])" if ($i_2 + 1 -le $array_bytes_to_find_5_2D.GetUpperBound(1)) { if ($array_bytes_to_find_5_2D[$i_1, $($i_2 + 1)] -ne $null) { Write-Host -NoNewline " " } } } Write-Host } Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } Write-Host #> Write-Host -NoNewline "`r`nAnalyse en cours... " $file_input = [System.IO.File]::OpenRead($file_fullname) # Ouverture du fichier en lecture $file_output = [System.IO.File]::Create("$file_fullname.temporary") # Ouverture du fichier en écriture $array_bytes_to_find_1_2D_ubound = $array_bytes_to_find_1_2D.GetUpperBound(0) $array_bytes_to_find_2_2D_ubound = $array_bytes_to_find_2_2D.GetUpperBound(0) $array_bytes_to_find_3_2D_ubound = $array_bytes_to_find_3_2D.GetUpperBound(0) $array_bytes_to_find_4_2D_ubound = $array_bytes_to_find_4_2D.GetUpperBound(0) $array_bytes_to_find_5_2D_ubound = $array_bytes_to_find_5_2D.GetUpperBound(0) $array_byte_buffer_1 = @() $array_byte_buffer_2 = @() $array_match_found_1 = @() $array_match_found_2 = @() $byte_buffer_read = New-Object byte[] 1 $byte_read = 0 $i_byte_check = 0 $i_replacement_count = 0 while ($file_input.Read($byte_buffer_read, 0, 1) -ne 0) { $byte_read = $byte_buffer_read[0] # Write-Host "Caractère lu (hexadécimal $($byte_read.ToString("X2")) = décimal $byte_read) : ""$([char]$byte_read)""" # L'octet lu est stocké dans la dernière case d'un tableau (buffer). $array_byte_buffer_1 += $byte_read # Write-Host "Contenu du buffer : $($array_byte_buffer_1 -join " ")" switch ($i_byte_check) { 0 { # On considère que le buffer peut contenir plusieurs octets en attente d'être traités, # c'est-à-dire écrits dans le fichier de sortie s'il n'existe aucune correspondance. # Chaque 1er octet traité disparaît du buffer, dont la taille se réduit. # Lorsque sa taille atteint 0 (GetUpperBound = -1), le buffer est vide, # tous les octets ont été traités. $b_exit_while_1 = $flase while ($array_byte_buffer_1.GetUpperBound(0) -ge 0 -and $b_exit_while_1 -eq $flase) { # Première boucle de vérification. # On compare le 1er octet ($i_byte_check = 0) du buffer # aux octets stockés dans les cases de la 1ère dimension du 1er tableau. $i_0 = 0 while ($i_0 -le $array_bytes_to_find_1_2D_ubound -and $b_exit_while_1 -eq $flase) { # Si il correspond à une case, # l'écriture du fichier de sortie est suspendue ($i_byte_check ≠ 0) # et l'octet reste stocké dans le buffer. if ($array_byte_buffer_1[$i_byte_check] -eq $array_bytes_to_find_1_2D[$i_0, 0]) { # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_bytes_to_find_1_2D[$i_0, 0])" $b_exit_while_1 = $true $i_byte_check++ # $i_byte_check = 1 $i_0-- } $i_0++ } # Si il ne correspond pas, l'octet est traité, # c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. if ($b_exit_while_1 -eq $flase) { $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) # Si le buffer contient plusieurs cases, # on les décale vers l'arrière et on le raccourcit d'une case. if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } } break } 1 { # Deuxième boucle de vérification. # On compare le 2ème octet ($i_byte_check = 1) du buffer # aux octets stockés dans les cases de la 1ère dimension du 2ème tableau. $b_exit_while_1 = $flase $i_1 = 0 while ($i_1 -le $array_bytes_to_find_2_2D_ubound -and $b_exit_while_1 -eq $flase) { # Si il correspond à une case, # on compare la 2ème dimension de la case du 1er tableau précédent # à la 2ème dimension de cette case de ce 2ème tableau et # on stocke les numéros communs dans un tableau : $array_match_found_1. if ($array_byte_buffer_1[$i_byte_check] -eq $array_bytes_to_find_2_2D[$i_1, 0]) { $b_exit_while_1 = $true $array_match_found_1 = @() $i_0_2D = 1 $b_exit_while_2 = $false while ($i_0_2D -le $array_bytes_to_find_1_2D.GetUpperBound(1) -and $b_exit_while_2 -eq $false) { if ($array_bytes_to_find_1_2D[$i_0, $i_0_2D] -ne $null) { $i_1_2D = 1 $b_exit_while_3 = $false while ($i_1_2D -le $array_bytes_to_find_2_2D.GetUpperBound(1) -and $b_exit_while_3 -eq $false) { if ($array_bytes_to_find_2_2D[$i_1, $i_1_2D] -ne $null) { if ($array_bytes_to_find_1_2D[$i_0, $i_0_2D] -eq $array_bytes_to_find_2_2D[$i_1, $i_1_2D]) { $array_match_found_1 += $array_bytes_to_find_1_2D[$i_0, $i_0_2D] } $i_1_2D++ } else { $b_exit_while_3 = $true } } $i_0_2D++ } else { $b_exit_while_2 = $true } } # Si le tableau n'est pas vide, il indique le ou les numéros # des chaînes qui commencent par ces 2 octets. Dans ce cas : # l'écriture du fichier de sortie reste suspendue ($i_byte_check ≠ 0) # et les octets restent stockés dans le buffer. if ($array_match_found_1.GetUpperBound(0) -ge 0) { # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_bytes_to_find_2_2D[$i_1, 0])" # Write-Host "Les octets du buffer ""$($array_byte_buffer_1 -join " ")"" doivent commencer la/les chaîne(s) ""$($array_match_found_1 -join " ")""" $i_byte_check++ # $i_byte_check = 2 } # Si le tableau est vide, les 2 octets ne correspondent # à aucune chaîne à rechercher. C'est la même situation que # si le 2ème octet ne correspond à aucune case du 2ème tableau. } $i_1++ } # Si il ne correspond pas, le premier octet est traité, # c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. # De plus $i_byte_check est réinitialisée donc on retourne # à la première boucle de vérification pour vider le buffer. if ($b_exit_while_1 -eq $flase -or $array_match_found_1.GetUpperBound(0) -lt 0) { $i_byte_check = 0 $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) # Si le buffer contient plusieurs cases, # on les décale vers l'arrière et on le raccourcit d'une case. if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } break } 2 { # Troisième boucle de vérification. # On compare le 3ème octet ($i_byte_check = 2) du buffer # aux octets stockés dans les cases de la 1ère dimension du 3ème tableau. $b_exit_while_1 = $flase $i_2 = 0 while ($i_2 -le $array_bytes_to_find_3_2D_ubound -and $b_exit_while_1 -eq $flase) { # Si il correspond à une case, # on compare le tableau précédent $array_match_found_1 # à la 2ème dimension de cette case de ce 3ème tableau et # on stocke les numéros communs dans $array_match_found_1 # par l'intermédiaire d'un tableau temporaire : $array_match_found_2. if ($array_byte_buffer_1[$i_byte_check] -eq $array_bytes_to_find_3_2D[$i_2, 0]) { $b_exit_while_1 = $true $array_match_found_2 = @() $i_1_2D = 0 $b_exit_while_2 = $false while ($i_1_2D -le $array_match_found_1.GetUpperBound(0) -and $b_exit_while_2 -eq $false) { if ($array_match_found_1[$i_1_2D] -ne $null) { $i_2_2D = 1 $b_exit_while_3 = $false while ($i_2_2D -le $array_bytes_to_find_3_2D.GetUpperBound(1) -and $b_exit_while_3 -eq $false) { if ($array_bytes_to_find_3_2D[$i_2, $i_2_2D] -ne $null) { if ($array_match_found_1[$i_1_2D] -eq $array_bytes_to_find_3_2D[$i_2, $i_2_2D]) { $array_match_found_2 += $array_match_found_1[$i_1_2D] } $i_2_2D++ } else { $b_exit_while_3 = $true } } $i_1_2D++ } else { $b_exit_while_2 = $true } } $array_match_found_1 = $array_match_found_2 # Si le tableau n'est pas vide, il indique le ou les numéros # des chaînes qui commencent par ces 3 octets. Dans ce cas : # l'écriture du fichier de sortie reste suspendue ($i_byte_check ≠ 0) # et les octets restent stockés dans le buffer. if ($array_match_found_1.GetUpperBound(0) -ge 0) { Write-Host -NoNewline "*" # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_bytes_to_find_3_2D[$i_2, 0])" # Write-Host "Les octets du buffer ""$($array_byte_buffer_1 -join " ")"" doivent commencer la/les chaîne(s) ""$($array_match_found_1 -join " ")""" $i_byte_check++ # $i_byte_check = 3 } # Si le tableau est vide, les 3 octets ne correspondent # à aucune chaîne à rechercher. C'est la même situation que # si le 3ème octet ne correspond à aucune case du 3ème tableau. } $i_2++ } # Si il ne correspond pas, le premier octet est traité, # c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. # De plus $i_byte_check est réinitialisée donc on retourne # à la première boucle de vérification pour vider le buffer. if ($b_exit_while_1 -eq $flase -or $array_match_found_1.GetUpperBound(0) -lt 0) { $i_byte_check = 0 $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) # Si le buffer contient plusieurs cases, # on les décale vers l'arrière et on le raccourcit d'une case. if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } break } 3 { $b_exit_while_1 = $flase $i_3 = 0 while ($i_3 -le $array_bytes_to_find_4_2D_ubound -and $b_exit_while_1 -eq $flase) { if ($array_byte_buffer_1[$i_byte_check] -eq $array_bytes_to_find_4_2D[$i_3, 0]) { $b_exit_while_1 = $true $array_match_found_2 = @() $i_2_2D = 0 $b_exit_while_2 = $false while ($i_2_2D -le $array_match_found_1.GetUpperBound(0) -and $b_exit_while_2 -eq $false) { if ($array_match_found_1[$i_2_2D] -ne $null) { $i_3_2D = 1 $b_exit_while_3 = $false while ($i_3_2D -le $array_bytes_to_find_4_2D.GetUpperBound(1) -and $b_exit_while_3 -eq $false) { if ($array_bytes_to_find_4_2D[$i_3, $i_3_2D] -ne $null) { if ($array_match_found_1[$i_2_2D] -eq $array_bytes_to_find_4_2D[$i_3, $i_3_2D]) { $array_match_found_2 += $array_match_found_1[$i_2_2D] } $i_3_2D++ } else { $b_exit_while_3 = $true } } $i_2_2D++ } else { $b_exit_while_2 = $true } } $array_match_found_1 = $array_match_found_2 if ($array_match_found_1.GetUpperBound(0) -ge 0) { Write-Host -NoNewline "*" # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_bytes_to_find_4_2D[$i_3, 0])" # Write-Host "Les octets du buffer ""$($array_byte_buffer_1 -join " ")"" doivent commencer la/les chaîne(s) ""$($array_match_found_1 -join " ")""" $i_byte_check++ # $i_byte_check = 4 } } $i_3++ } if ($b_exit_while_1 -eq $flase -or $array_match_found_1.GetUpperBound(0) -lt 0) { $i_byte_check = 0 $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } break } 4 { $b_exit_while_1 = $flase $i_4 = 0 while ($i_4 -le $array_bytes_to_find_5_2D_ubound -and $b_exit_while_1 -eq $flase) { if ($array_byte_buffer_1[$i_byte_check] -eq $array_bytes_to_find_5_2D[$i_4, 0]) { $b_exit_while_1 = $true $array_match_found_2 = @() $i_3_2D = 0 $b_exit_while_2 = $false while ($i_3_2D -le $array_match_found_1.GetUpperBound(0) -and $b_exit_while_2 -eq $false) { if ($array_match_found_1[$i_3_2D] -ne $null) { $i_4_2D = 1 $b_exit_while_3 = $false while ($i_4_2D -le $array_bytes_to_find_5_2D.GetUpperBound(1) -and $b_exit_while_3 -eq $false) { if ($array_bytes_to_find_5_2D[$i_4, $i_4_2D] -ne $null) { if ($array_match_found_1[$i_3_2D] -eq $array_bytes_to_find_5_2D[$i_4, $i_4_2D]) { $array_match_found_2 += $array_match_found_1[$i_3_2D] } $i_4_2D++ } else { $b_exit_while_3 = $true } } $i_3_2D++ } else { $b_exit_while_2 = $true } } $array_match_found_1 = $array_match_found_2 if ($array_match_found_1.GetUpperBound(0) -ge 0) { Write-Host -NoNewline "*" # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_bytes_to_find_5_2D[$i_4, 0])" # Write-Host "Les octets du buffer ""$($array_byte_buffer_1 -join " ")"" doivent commencer la/les chaîne(s) ""$($array_match_found_1 -join " ")""" $i_byte_check++ # $i_byte_check = 5 } } $i_4++ } if ($b_exit_while_1 -eq $flase -or $array_match_found_1.GetUpperBound(0) -lt 0) { $i_byte_check = 0 $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } break } default { # On prend le tableau $array_match_found_1, il contient le # (ou les) numéro de case du tableau $array_hex_strings_to_find # qui lui-même contient la chaîne complète des octets à analyser # dont les 5 premiers octets correspondent. # Remarque : il se peut que plusieurs chaînes aient leurs 5 premiers # octets en commun. Voire que seul le dernier octet soit différent. # Donc on analyse chaque case du tableau $array_match_found_1. $b_exit_while_1 = $flase $i_5 = 0 # (Inutile car i_5 reste à 0) while ($i_5 -le $array_match_found_1.GetUpperBound(0) -and $b_exit_while_1 -eq $flase) { # On analyse la chaîne contenue dans $array_hex_strings_to_find. # Si la chaîne continue à correspondre, on teste l'octet suivant. if ($array_byte_buffer_1[$i_byte_check].ToString("X2") -eq $array_hex_strings_to_find[$array_match_found_1[$i_5]].Substring(2 * $i_byte_check, 2)) { Write-Host -NoNewline "*" # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_hex_strings_to_find[$array_match_found_1[$i_5]].Substring(2 * $i_byte_check, 2))" $b_exit_while_1 = $true $i_byte_check++ } # Si la chaîne ne correspond plus, alors on retire son numéro du tableau $array_match_found_1. # Et si le tableau est vide, alors aucune chaîne ne correspondait, # donc le premier octet est traité et $i_byte_check est réinitialisée. else { if ($array_match_found_1.GetUpperBound(0) -ge 1) { $array_match_found_2 = @() $array_match_found_2 = $array_match_found_1[1..($($array_match_found_1.GetUpperBound(0) + 1) - 1)] $array_match_found_1 = $array_match_found_2 } else { $array_match_found_1 = @() $i_byte_check = 0 $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } } if ($i_byte_check -gt 0) { # Si la correspondance va jusqu'au bout de la chaîne, alors la chaîne a été détectée. if ($i_byte_check -eq $array_hex_strings_to_find[$array_match_found_1[$i_5]].Length / 2) { # Dans ce cas on écrit la nouvelle chaîne et on vide le buffer. for ($i = 0; $i -le $array_hex_strings_to_replace[$array_match_found_1[$i_5]].Length - 1; $i += 2) { $file_output.WriteByte([byte]::Parse($array_hex_strings_to_replace[$array_match_found_1[$i_5]].Substring($i, 2), [System.Globalization.NumberStyles]::HexNumber)) } # Write-Host `r`n"Contenu de la chaîne n°$($array_match_found_1[$i_5] + 1) ($($array_hex_strings_to_find[$array_match_found_1[$i_5]].Length / 2) cases) : $($array_hex_strings_to_find[$array_match_found_1[$i_5]])`r`nContenu du buffer ($($array_byte_buffer_1.GetUpperBound(0) + 1) cases) : $($array_byte_buffer_1 -join " ")" # On vide le buffer de la chaîne à rechercher. if ($array_byte_buffer_1.GetUpperBound(0) -ge $array_hex_strings_to_find[$array_match_found_1[$i_5]].Length / 2) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[($array_hex_strings_to_find[$array_match_found_1[$i_5]].Length / 2)..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 # Write-Host "Contenu restant du buffer = : $($array_byte_buffer_1 -join " ")" } else { $array_byte_buffer_1 = @() } $i_byte_check = 0 $i_replacement_count++ Write-Host "`r`nFichier :`r`n$file_fullname`r`nSéquence n°$($array_match_found_1[$i_5] + 1) trouvée :`r`n$($array_hex_strings_to_find[$array_match_found_1[$i_5]])`r`nRemplacée par :`r`n$($array_hex_strings_to_replace[$array_match_found_1[$i_5]])`r`n" Write-Host -NoNewline "`r`nAnalyse en cours... " } } } } } } $file_input.Close() $file_output.Close() $file_input.Dispose() $file_output.Dispose() return $i_replacement_count } function i_my_rename_file([string]$file_fullname, [string]$file_fullname_new) { if ((Test-Path $file_fullname) -eq $false) { Write-Host "Erreur, le fichier :`r`n$file_fullname`r`nn'existe pas, impossible de le renommer en :`r`n$file_fullname_new" Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } Rename-Item -Path $file_fullname -NewName $file_fullname_new -ErrorAction Stop Write-Host "Le fichier :`r`n$file_fullname`r`na été renommé en :`r`n$file_fullname_new`r`n" if ((Test-Path $file_fullname_new) -eq $false) { Write-Host "Erreur, le fichier :`r`n$file_fullname`r`nn'a pas pu être renommé." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } return 0 } function i_my_fix_corrupted_file([string[]]$corrupted_file_error_ori, [string[]]$corrupted_file_error_fix, [string]$corrupted_file) { $i_installation_type = 0 if ($program_folder -ne "") { if ((Test-Path "$program_folder\$corrupted_file") -eq $false) { Write-Host "Erreur, fichier non détecté :`r`n$program_folder\$corrupted_file" Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } $i_installation_type = 1 Write-Host "Fichier détecté :`r`n$program_folder\$corrupted_file`r`n" } if ((Test-Path "$program_folder_portable_32\$corrupted_file") -eq $true) { $i_installation_type = 2 Write-Host "Fichier détecté :`r`n$program_folder_portable_32\$corrupted_file`r`n" } if ((Test-Path "$program_folder_portable_64\$corrupted_file") -eq $true) { $i_installation_type += 3 Write-Host "Fichier détecté :`r`n$program_folder_portable_64\$corrupted_file`r`n" } if ((Test-Path "$program_folder_installed_32\$corrupted_file") -eq $true) { $i_installation_type = 6 Write-Host "Fichier détecté :`r`n$program_folder_portable_32\$corrupted_file`r`n" } if ((Test-Path "$program_folder_installed_64\$corrupted_file") -eq $true) { $i_installation_type = 7 Write-Host "Fichier détecté :`r`n$program_folder_portable_64\$corrupted_file`r`n" } if ($i_installation_type -eq 0) { Write-Host "Erreur, aucun fichier détecté." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } if ($i_installation_type -eq 1) { if ((Test-Path -Path "$program_folder\$corrupted_file.bak" -PathType Leaf) -eq $true) { Write-Host "Attention, le fichier de sauvegarde :`r`n$program_folder\$corrupted_file.bak" Write-Host "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," Write-Host "appuyez sur ""o"" pour supprimer le fichier "".bak"" et continuer,`r`nsinon appuyez sur une autre touche pour quitter." if ($Host.UI.RawUI.KeyAvailable -eq $true) { Write-Host "`r`nAppuyez sur une touche pour continuer..." while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } $user_response = Read-Host "`r`nVoulez-vous continuer ? (o = oui)" $user_response = $user_response.ToLower() if ($user_response -ne "o") { exit 0 } Remove-Item -Path "$program_folder\$corrupted_file.bak" -Force Write-Host "Le fichier :`r`n$program_folder\$corrupted_file.bak`r`na été supprimé." } $number_of_replacements = i_my_replace_array_hex_strings_in_file $corrupted_file_error_ori $corrupted_file_error_fix ("$program_folder\$corrupted_file") Write-Host "`r`n`r`n$number_of_replacements remplacement(s) effectué(s) sur le fichier :`r`n$program_folder\$corrupted_file`r`n" $i_return = i_my_rename_file "$program_folder\$corrupted_file" "$program_folder\$corrupted_file.bak" $i_return = i_my_rename_file "$program_folder\$corrupted_file.temporary" "$program_folder\$corrupted_file" } if ($i_installation_type -eq 2 -or $i_installation_type -eq 5) { if ((Test-Path -Path "$program_folder_portable_32\$corrupted_file.bak" -PathType Leaf) -eq $true) { Write-Host "Attention, le fichier de sauvegarde :`r`n$program_folder_portable_32\$corrupted_file.bak" Write-Host "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," Write-Host "appuyez sur ""o"" pour supprimer le fichier "".bak"" et continuer,`r`nsinon appuyez sur une autre touche pour quitter." if ($Host.UI.RawUI.KeyAvailable -eq $true) { Write-Host "`r`nAppuyez sur une touche pour continuer..." while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } $user_response = Read-Host "`r`nVoulez-vous continuer ? (o = oui)" $user_response = $user_response.ToLower() if ($user_response -ne "o") { exit 0 } Remove-Item -Path "$program_folder_portable_32\$corrupted_file.bak" -Force Write-Host "Le fichier :`r`n$program_folder_portable_32\$corrupted_file.bak`r`na été supprimé." } $number_of_replacements = i_my_replace_array_hex_strings_in_file $corrupted_file_error_ori $corrupted_file_error_fix ("$program_folder_portable_32\$corrupted_file") Write-Host "`r`n`r`n$number_of_replacements remplacement(s) effectué(s) sur le fichier :`r`n$program_folder_portable_32\$corrupted_file`r`n" $i_return = i_my_rename_file "$program_folder_portable_32\$corrupted_file" "$program_folder_portable_32\$corrupted_file.bak" $i_return = i_my_rename_file "$program_folder_portable_32\$corrupted_file.temporary" "$program_folder_portable_32\$corrupted_file" } if ($i_installation_type -eq 3 -or $i_installation_type -eq 5) { if ((Test-Path -Path "$program_folder_portable_64\$corrupted_file.bak" -PathType Leaf) -eq $true) { Write-Host "Attention, le fichier de sauvegarde :`r`n$program_folder_portable_64\$corrupted_file.bak" Write-Host "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," Write-Host "appuyez sur ""o"" pour supprimer le fichier "".bak"" et continuer,`r`nsinon appuyez sur une autre touche pour quitter." if ($Host.UI.RawUI.KeyAvailable -eq $true) { Write-Host "`r`nAppuyez sur une touche pour continuer..." while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } $user_response = Read-Host "`r`nVoulez-vous continuer ? (o = oui)" $user_response = $user_response.ToLower() if ($user_response -ne "o") { exit 0 } Remove-Item -Path "$program_folder_portable_64\$corrupted_file.bak" -Force Write-Host "Le fichier :`r`n$program_folder_portable_64\$corrupted_file.bak`r`na été supprimé." } $number_of_replacements = i_my_replace_array_hex_strings_in_file $corrupted_file_error_ori $corrupted_file_error_fix ("$program_folder_portable_64\$corrupted_file") Write-Host "`r`n`r`n$number_of_replacements remplacement(s) effectué(s) sur le fichier :`r`n$program_folder_portable_64\$corrupted_file`r`n" $i_return = i_my_rename_file "$program_folder_portable_64\$corrupted_file" "$program_folder_portable_64\$corrupted_file.bak" $i_return = i_my_rename_file "$program_folder_portable_64\$corrupted_file.temporary" "$program_folder_portable_64\$corrupted_file" } if ($i_installation_type -eq 6) { if ((Test-Path -Path "$program_folder_installed_32\$corrupted_file.bak" -PathType Leaf) -eq $true) { Write-Host "Attention, le fichier de sauvegarde :`r`n$program_folder_installed_32\$corrupted_file.bak" Write-Host "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," Write-Host "appuyez sur ""o"" pour supprimer le fichier "".bak"" et continuer,`r`nsinon appuyez sur une autre touche pour quitter." if ($Host.UI.RawUI.KeyAvailable -eq $true) { Write-Host "`r`nAppuyez sur une touche pour continuer..." while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } $user_response = Read-Host "`r`nVoulez-vous continuer ? (o = oui)" $user_response = $user_response.ToLower() if ($user_response -ne "o") { exit 0 } Remove-Item -Path "$program_folder_installed_32\$corrupted_file.bak" -Force Write-Host "Le fichier :`r`n$program_folder_installed_32\$corrupted_file.bak`r`na été supprimé." } $number_of_replacements = i_my_replace_array_hex_strings_in_file $corrupted_file_error_ori $corrupted_file_error_fix ("$program_folder_installed_32\$corrupted_file") Write-Host "`r`n`r`n$number_of_replacements remplacement(s) effectué(s) sur le fichier :`r`n$program_folder_installed_32\$corrupted_file`r`n" $i_return = i_my_rename_file "$program_folder_installed_32\$corrupted_file" "$program_folder_installed_32\$corrupted_file.bak" $i_return = i_my_rename_file "$program_folder_installed_32\$corrupted_file.temporary" "$program_folder_installed_32\$corrupted_file" } if ($i_installation_type -eq 7) { if ((Test-Path -Path "$program_folder_installed_64\$corrupted_file.bak" -PathType Leaf) -eq $true) { Write-Host "Attention, le fichier de sauvegarde :`r`n$program_folder_installed_64\$corrupted_file.bak" Write-Host "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," Write-Host "appuyez sur ""o"" pour supprimer le fichier "".bak"" et continuer,`r`nsinon appuyez sur une autre touche pour quitter." if ($Host.UI.RawUI.KeyAvailable -eq $true) { Write-Host "`r`nAppuyez sur une touche pour continuer..." while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } $user_response = Read-Host "`r`nVoulez-vous continuer ? (o = oui)" $user_response = $user_response.ToLower() if ($user_response -ne "o") { exit 0 } Remove-Item -Path "$program_folder_installed_64\$corrupted_file.bak" -Force Write-Host "Le fichier :`r`n$program_folder_installed_64\$corrupted_file.bak`r`na été supprimé." } $number_of_replacements = i_my_replace_array_hex_strings_in_file $corrupted_file_error_ori $corrupted_file_error_fix ("$program_folder_installed_64\$corrupted_file") Write-Host "`r`n`r`n$number_of_replacements remplacement(s) effectué(s) sur le fichier :`r`n$program_folder_installed_64\$corrupted_file`r`n" $i_return = i_my_rename_file "$program_folder_installed_64\$corrupted_file" "$program_folder_installed_64\$corrupted_file.bak" $i_return = i_my_rename_file "$program_folder_installed_64\$corrupted_file.temporary" "$program_folder_installed_64\$corrupted_file" } return $number_of_replacements } # _____________________________________________________________________________ # Partie à modifier pour ajouter des fichiers à corriger : # Lancement du script : $number_of_replacements = i_my_fix_corrupted_file $corrupted_file_1_error_ori $corrupted_file_1_error_fix ("$corrupted_file_1") # _____________________________________________________________________________ # Partie à ne pas modifier : $pause_message = "L'exécution de ce programme est terminée." Write-Host "$pause_message`r`n`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 Thunderbird en VBScript ' Character encoding = UTF-16 LE (Byte Order Mark = FF FE) ' End-of-line = Windows (CR LF) ' Composants requis : set object_shell = WScript.CreateObject("WScript.Shell") set object_file_system = WScript.CreateObject("Scripting.FileSystemObject") current_folder = object_file_system.GetParentFolderName(WScript.ScriptFullName) ' _____________________________________________________________________________ ' Partie à modifier pour ajouter des fichiers et erreurs à corriger : ' Emplacement personnalisé du dossier contenant le fichier "thunderbird.exe". ' Vous pouvez le laisser vide. Exemple : ' program_folder = current_folder & "\Mozilla Thunderbird" program_folder = "" ' Emplacements connus : program_folder_portable_32 = current_folder & "\App\Thunderbird" program_folder_portable_64 = current_folder & "\App\Thunderbird64" program_folder_installed_32 = object_shell.ExpandEnvironmentStrings("%ProgramFiles(x86)%") & "\Mozilla Thunderbird" program_folder_installed_64 = object_shell.ExpandEnvironmentStrings("%ProgramFiles%") & "\Mozilla Thunderbird" ' Fichiers à réparer : corrupted_file_1 = "omni.ja" ' Réparations à faire : dim corrupted_file_1_error_ori() redim corrupted_file_1_error_ori(-1) dim corrupted_file_1_error_fix() redim corrupted_file_1_error_fix(-1) ' away=absent·e => away=absent redim preserve corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori) + 1) corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori)) = "6E74C2B7650A" ' é·e redim preserve corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix) + 1) corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix)) = "6E740A0A0A0A" ' nt ' utilisateur·trice => utilisateur redim preserve corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori) + 1) corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori)) = "C2B774726963650A" ' ·trice redim preserve corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix) + 1) corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix)) = "0A0A0A0A0A0A0A0A" ' ' Jean·ne Dupont => Jean Dupont redim preserve corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori) + 1) corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori)) = "C2B76E65204475706F6E740A" ' ·ne Dupont redim preserve corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix) + 1) corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix)) = "204475706F6E740A0A0A0A0A" ' Dupont ' jean.ne.dupont@example.com => jean.dupont@example.com redim preserve corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori) + 1) corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori)) = "2E6E652E6475706F6E74406578616D706C652E636F6D0A" ' .ne.dupont@example.com redim preserve corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix) + 1) corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix)) = "2E6475706F6E74406578656D706C652E636F6D0A0A0A0A" ' .dupont@exemple.com ' averti·e lorsque la génération de clé sera terminée. => averti lorsque la génération de clé sera terminée. redim preserve corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori) + 1) corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori)) = "C2B765206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A" ' ·e lorsque la génération de clé sera terminée. redim preserve corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix) + 1) corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix)) = "206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A0A0A0A" ' lorsque la génération de clé sera terminée. ' satisfait·e du résultat. => satisfait du résultat. redim preserve corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori) + 1) corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori)) = "C2B7652064752072C3A973756C7461742E0A" ' ·e du résultat. redim preserve corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix) + 1) corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix)) = "2064752072C3A973756C7461742E0A0A0A0A" ' du résultat. ' connecté·e plusieurs fois, une autre session peut avoir reçu le message. => connecté plusieurs fois, une autre session peut avoir reçu le message. redim preserve corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori) + 1) corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori)) = "C2B76520706C7573696575727320666F69732C20756E652061757472652073657373696F6E20706575742061766F6972207265C3A775206C65206D6573736167652E0A" ' ·e plusieurs fois, une autre session peut avoir reçu le message. redim preserve corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix) + 1) corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix)) = "20706C7573696575727320666F69732C20756E652061757472652073657373696F6E20706575742061766F6972207265C3A775206C65206D6573736167652E0A0A0A0A" ' plusieurs fois, une autre session peut avoir reçu le message. ' pisté·e => pisté redim preserve corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori) + 1) corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori)) = "C3A9C2B7650A" ' é·e redim preserve corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix) + 1) corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix)) = "C3A90A0A0A0A" ' é ' _____________________________________________________________________________ ' Partie à ne pas modifier : function i_my_replace_array_hex_strings_in_file(byval array_hex_strings_to_find, byval array_hex_strings_to_replace, byval file_fullname) if ubound(array_hex_strings_to_find) <> ubound(array_hex_strings_to_replace) then MsgBox "Erreur :" & vbCrLf & "Le nombre de cases dans le tableau des chaînes hexadécimales à détecter (" & ubound(array_hex_strings_to_find) + 1 & ")" & vbCrLf & "et dans le tableau des chaînes hexadécimales à remplacer (" & ubound(array_hex_strings_to_replace) + 1 & ")" & vbCrLf & "n'est pas identique.", 48, "Erreur" ' 0 = vbOKOnly vbDefaultButton1 vbApplicationModal 48 = vbExclamation WScript.Quit(0) end if for i = 0 to ubound(array_hex_strings_to_find) step 1 if len(array_hex_strings_to_find(i)) <> len(array_hex_strings_to_replace(i)) then MsgBox "Erreur :" & vbCrLf & "La variable " & array_hex_strings_to_find(i) & " et" & vbCrLf & "la variable " & array_hex_strings_to_replace(i) & vbCrLf _ & "n'ont pas le même nombre de caractères (" & len(array_hex_strings_to_find(i)) & " contre " & len(array_hex_strings_to_replace(i)) & ").", 48, "Erreur" WScript.Quit(0) end if if len(array_hex_strings_to_find(i)) MOD 2 <> 0 then MsgBox "Erreur, les variables :" & vbCrLf & array_hex_strings_to_find(i) & " et" & vbCrLf & array_hex_strings_to_replace(i) & vbCrLf & "ont un nombre impair de caractères.", 48, "Erreur" WScript.Quit(0) end if if len(array_hex_strings_to_find(i)) < 12 then MsgBox "Erreur, les variables :" & vbCrLf & array_hex_strings_to_find(i) & " et" & vbCrLf & array_hex_strings_to_replace(i) & vbCrLf _ & "doivent avoir au moins 12 caractères hexadécimaux pour représenter" & vbCrLf _ & "au moins 6 octets. Or ici, elles n'en contiennent que " & len(array_hex_strings_to_find(i)) & ".", 48, "Erreur" WScript.Quit(0) end if next set object_file = object_file_system.CreateTextFile(file_fullname & ".temporary", TRUE, FALSE) ' (TRUE = Écraser si existe déjà) (FALSE = Utiliser ASCII au lieu d'Unicode UTF16LE donc pas de Byte Order Mark FFFE) object_file.Close if object_file_system.FileExists(file_fullname & ".temporary") = FALSE then MsgBox "Erreur, le fichier :" & vbCrLf & file_fullname & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur.", 48, "Erreur" WScript.Quit(0) end if ' Pour aller plus vite, on crée 5 tableaux en 2 dimensions. ' Nous sommes obligés de créer chaque dimension indépendamment car ' il est impossible de redimensionner dynamiquement les 2 dimensions. ' Concernant la 1ère dimension : ' Le 1er tableau contiendra les premiers octets de toutes les chaînes ' à rechercher, convertis en décimal et en éliminant les doublons. ' Le 2ème tableau contiendra les deuxièmes octets, etc. ' Le 3ème tableau contiendra les troisièmes octets, etc. dim array_bytes_to_find_1() redim array_bytes_to_find_1(-1) dim array_bytes_to_find_2() redim array_bytes_to_find_2(-1) dim array_bytes_to_find_3() redim array_bytes_to_find_3(-1) dim array_bytes_to_find_4() redim array_bytes_to_find_4(-1) dim array_bytes_to_find_5() redim array_bytes_to_find_5(-1) for i_1 = 0 to ubound(array_hex_strings_to_find) step 1 b_already_exists = FALSE for i_2 = 0 to ubound(array_bytes_to_find_1) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_1), 1, 2)) = array_bytes_to_find_1(i_2) then b_already_exists = TRUE end if next if b_already_exists = FALSE then redim preserve array_bytes_to_find_1(ubound(array_bytes_to_find_1) + 1) array_bytes_to_find_1(ubound(array_bytes_to_find_1)) = cint("&H" & mid(array_hex_strings_to_find(i_1), 1, 2)) end if b_already_exists = FALSE for i_2 = 0 to ubound(array_bytes_to_find_2) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_1), 3, 2)) = array_bytes_to_find_2(i_2) then b_already_exists = TRUE end if next if b_already_exists = FALSE then redim preserve array_bytes_to_find_2(ubound(array_bytes_to_find_2) + 1) array_bytes_to_find_2(ubound(array_bytes_to_find_2)) = cint("&H" & mid(array_hex_strings_to_find(i_1), 3, 2)) end if b_already_exists = FALSE for i_2 = 0 to ubound(array_bytes_to_find_3) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_1), 5, 2)) = array_bytes_to_find_3(i_2) then b_already_exists = TRUE end if next if b_already_exists = FALSE then redim preserve array_bytes_to_find_3(ubound(array_bytes_to_find_3) + 1) array_bytes_to_find_3(ubound(array_bytes_to_find_3)) = cint("&H" & mid(array_hex_strings_to_find(i_1), 5, 2)) end if b_already_exists = FALSE for i_2 = 0 to ubound(array_bytes_to_find_4) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_1), 7, 2)) = array_bytes_to_find_4(i_2) then b_already_exists = TRUE end if next if b_already_exists = FALSE then redim preserve array_bytes_to_find_4(ubound(array_bytes_to_find_4) + 1) array_bytes_to_find_4(ubound(array_bytes_to_find_4)) = cint("&H" & mid(array_hex_strings_to_find(i_1), 7, 2)) end if b_already_exists = FALSE for i_2 = 0 to ubound(array_bytes_to_find_5) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_1), 9, 2)) = array_bytes_to_find_5(i_2) then b_already_exists = TRUE end if next if b_already_exists = FALSE then redim preserve array_bytes_to_find_5(ubound(array_bytes_to_find_5) + 1) array_bytes_to_find_5(ubound(array_bytes_to_find_5)) = cint("&H" & mid(array_hex_strings_to_find(i_1), 9, 2)) end if next ' Concernant la 2ème dimension : ' Pour chaque tableau, elle contiendra les numéros des chaînes ' auxquelles les octets correspondent (en commençant par 0). ' Imaginons que la 1ère case du 1er tableau contient l'octet C2 = 194 ' et plusieurs chaînes commencent par C2 (doublons), par exemple les ' chaînes 1 2 4 5 6, alors les chiffres 0 1 3 4 5 seront inscrits ' dans la 2ème dimension de la 1ère case du 1er tableau. dim array_bytes_to_find_1_2D() redim array_bytes_to_find_1_2D(ubound(array_bytes_to_find_1), 0) dim array_bytes_to_find_2_2D() redim array_bytes_to_find_2_2D(ubound(array_bytes_to_find_2), 0) dim array_bytes_to_find_3_2D() redim array_bytes_to_find_3_2D(ubound(array_bytes_to_find_3), 0) dim array_bytes_to_find_4_2D() redim array_bytes_to_find_4_2D(ubound(array_bytes_to_find_4), 0) dim array_bytes_to_find_5_2D() redim array_bytes_to_find_5_2D(ubound(array_bytes_to_find_5), 0) for i_1 = 0 to ubound(array_bytes_to_find_1_2D, 1) step 1 array_bytes_to_find_1_2D(i_1, 0) = array_bytes_to_find_1(i_1) i_2 = 1 for i_3 = 0 to ubound(array_hex_strings_to_find) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_3), 1, 2)) = array_bytes_to_find_1_2D(i_1, 0) then if ubound(array_bytes_to_find_1_2D, 2) < i_2 then redim preserve array_bytes_to_find_1_2D(ubound(array_bytes_to_find_1_2D, 1), ubound(array_bytes_to_find_1_2D, 2) + 1) end if array_bytes_to_find_1_2D(i_1, i_2) = i_3 i_2 = i_2 + 1 end if next next for i_1 = 0 to ubound(array_bytes_to_find_2_2D, 1) step 1 array_bytes_to_find_2_2D(i_1, 0) = array_bytes_to_find_2(i_1) i_2 = 1 for i_3 = 0 to ubound(array_hex_strings_to_find) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_3), 3, 2)) = array_bytes_to_find_2_2D(i_1, 0) then if ubound(array_bytes_to_find_2_2D, 2) < i_2 then redim preserve array_bytes_to_find_2_2D(ubound(array_bytes_to_find_2_2D, 1), ubound(array_bytes_to_find_2_2D, 2) + 1) end if array_bytes_to_find_2_2D(i_1, i_2) = i_3 i_2 = i_2 + 1 end if next next for i_1 = 0 to ubound(array_bytes_to_find_3_2D, 1) step 1 array_bytes_to_find_3_2D(i_1, 0) = array_bytes_to_find_3(i_1) i_2 = 1 for i_3 = 0 to ubound(array_hex_strings_to_find) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_3), 5, 2)) = array_bytes_to_find_3_2D(i_1, 0) then if ubound(array_bytes_to_find_3_2D, 2) < i_2 then redim preserve array_bytes_to_find_3_2D(ubound(array_bytes_to_find_3_2D, 1), ubound(array_bytes_to_find_3_2D, 2) + 1) end if array_bytes_to_find_3_2D(i_1, i_2) = i_3 i_2 = i_2 + 1 end if next next for i_1 = 0 to ubound(array_bytes_to_find_4_2D, 1) step 1 array_bytes_to_find_4_2D(i_1, 0) = array_bytes_to_find_4(i_1) i_2 = 1 for i_3 = 0 to ubound(array_hex_strings_to_find) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_3), 7, 2)) = array_bytes_to_find_4_2D(i_1, 0) then if ubound(array_bytes_to_find_4_2D, 2) < i_2 then redim preserve array_bytes_to_find_4_2D(ubound(array_bytes_to_find_4_2D, 1), ubound(array_bytes_to_find_4_2D, 2) + 1) end if array_bytes_to_find_4_2D(i_1, i_2) = i_3 i_2 = i_2 + 1 end if next next for i_1 = 0 to ubound(array_bytes_to_find_5_2D, 1) step 1 array_bytes_to_find_5_2D(i_1, 0) = array_bytes_to_find_5(i_1) i_2 = 1 for i_3 = 0 to ubound(array_hex_strings_to_find) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_3), 9, 2)) = array_bytes_to_find_5_2D(i_1, 0) then if ubound(array_bytes_to_find_5_2D, 2) < i_2 then redim preserve array_bytes_to_find_5_2D(ubound(array_bytes_to_find_5_2D, 1), ubound(array_bytes_to_find_5_2D, 2) + 1) end if array_bytes_to_find_5_2D(i_1, i_2) = i_3 i_2 = i_2 + 1 end if next next WScript_Echo_variable = "1ers octets à rechercher => Dans les chaînes : " & vbCrLf for i_1 = 0 to ubound(array_bytes_to_find_1_2D, 1) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_1_2D(i_1, 0) & " => " for i_2 = 1 to ubound(array_bytes_to_find_1_2D, 2) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_1_2D(i_1, i_2) if i_2 + 1 <= ubound(array_bytes_to_find_1_2D, 2) then if array_bytes_to_find_1_2D(i_1, i_2 + 1) <> "" then WScript_Echo_variable = WScript_Echo_variable & " " end if end if next WScript_Echo_variable = WScript_Echo_variable & vbCrLf Next ' WScript.Echo WScript_Echo_variable WScript_Echo_variable = "2èmes octets à rechercher => Dans les chaînes : " & vbCrLf for i_1 = 0 to ubound(array_bytes_to_find_2_2D, 1) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_2_2D(i_1, 0) & " => " for i_2 = 1 to ubound(array_bytes_to_find_2_2D, 2) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_2_2D(i_1, i_2) if i_2 + 1 <= ubound(array_bytes_to_find_2_2D, 2) then if array_bytes_to_find_2_2D(i_1, i_2 + 1) <> "" then WScript_Echo_variable = WScript_Echo_variable & " " end if end if next WScript_Echo_variable = WScript_Echo_variable & vbCrLf Next ' WScript.Echo WScript_Echo_variable WScript_Echo_variable = "3èmes octets à rechercher => Dans les chaînes : " & vbCrLf for i_1 = 0 to ubound(array_bytes_to_find_3_2D, 1) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_3_2D(i_1, 0) & " => " for i_2 = 1 to ubound(array_bytes_to_find_3_2D, 2) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_3_2D(i_1, i_2) if i_2 + 1 <= ubound(array_bytes_to_find_3_2D, 2) then if array_bytes_to_find_3_2D(i_1, i_2 + 1) <> "" then WScript_Echo_variable = WScript_Echo_variable & " " end if end if next WScript_Echo_variable = WScript_Echo_variable & vbCrLf Next ' WScript.Echo WScript_Echo_variable WScript_Echo_variable = "4èmes octets à rechercher => Dans les chaînes : " & vbCrLf for i_1 = 0 to ubound(array_bytes_to_find_4_2D, 1) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_4_2D(i_1, 0) & " => " for i_2 = 1 to ubound(array_bytes_to_find_4_2D, 2) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_4_2D(i_1, i_2) if i_2 + 1 <= ubound(array_bytes_to_find_4_2D, 2) then if array_bytes_to_find_4_2D(i_1, i_2 + 1) <> "" then WScript_Echo_variable = WScript_Echo_variable & " " end if end if next WScript_Echo_variable = WScript_Echo_variable & vbCrLf Next ' WScript.Echo WScript_Echo_variable WScript_Echo_variable = "5èmes octets à rechercher => Dans les chaînes : " & vbCrLf for i_1 = 0 to ubound(array_bytes_to_find_5_2D, 1) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_5_2D(i_1, 0) & " => " for i_2 = 1 to ubound(array_bytes_to_find_5_2D, 2) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_5_2D(i_1, i_2) if i_2 + 1 <= ubound(array_bytes_to_find_5_2D, 2) then if array_bytes_to_find_5_2D(i_1, i_2 + 1) <> "" then WScript_Echo_variable = WScript_Echo_variable & " " end if end if next WScript_Echo_variable = WScript_Echo_variable & vbCrLf Next ' WScript.Echo WScript_Echo_variable set file_input = object_file_system.OpenTextFile(file_fullname, 1) ' 1 = Ouverture du fichier en lecture set file_output = object_file_system.OpenTextFile(file_fullname & ".temporary", 2, TRUE, 0) ' 2 = Ouverture du fichier en écriture (TRUE = Fichier créé si n'existe pas) (0 = ASCII, -1 = Unicode, -2 = Par défaut) array_bytes_to_find_1_2D_ubound = ubound(array_bytes_to_find_1_2D, 1) array_bytes_to_find_2_2D_ubound = ubound(array_bytes_to_find_2_2D, 1) array_bytes_to_find_3_2D_ubound = ubound(array_bytes_to_find_3_2D, 1) array_bytes_to_find_4_2D_ubound = ubound(array_bytes_to_find_4_2D, 1) array_bytes_to_find_5_2D_ubound = ubound(array_bytes_to_find_5_2D, 1) dim array_byte_buffer_1() redim array_byte_buffer_1(-1) dim array_byte_buffer_2() redim array_byte_buffer_2(-1) dim array_match_found_1() redim array_match_found_1(-1) dim array_match_found_2() redim array_match_found_2(-1) byte_read = 0 i_byte_check = 0 i_replacement_count = 0 do until file_input.AtEndOfStream byte_read = asc(file_input.Read(1)) ' WScript.Echo "Caractère lu (hexadécimal " & string(2 - len(hex(byte_read)), "0") & ucase((hex(byte_read))) & " = décimal " & byte_read & ") : """ & chr(byte_read) & """" ' L'octet lu est stocké dans la dernière case d'un tableau (buffer). redim preserve array_byte_buffer_1(ubound(array_byte_buffer_1) + 1) array_byte_buffer_1(ubound(array_byte_buffer_1)) = byte_read ' WScript.Echo "Contenu du buffer : " & join(array_byte_buffer_1, " ") select case i_byte_check case 0 ' On considère que le buffer peut contenir plusieurs octets en attente d'être traités, ' c'est-à-dire écrits dans le fichier de sortie s'il n'existe aucune correspondance. ' Chaque 1er octet traité disparaît du buffer, dont la taille se réduit. ' Lorsque sa taille atteint 0 (ubound = -1), le buffer est vide, ' tous les octets ont été traités. b_exit_while_1 = FALSE while ubound(array_byte_buffer_1) >= 0 AND b_exit_while_1 = FALSE ' Première boucle de vérification. ' On compare le 1er octet (i_byte_check = 0) du buffer ' aux octets stockés dans les cases de la 1ère dimension du 1er tableau. i_0 = 0 while i_0 <= array_bytes_to_find_1_2D_ubound AND b_exit_while_1 = FALSE ' Si il correspond à une case, ' l'écriture du fichier de sortie est suspendue (i_byte_check ≠ 0) ' et l'octet reste stocké dans le buffer. if array_byte_buffer_1(i_byte_check) = array_bytes_to_find_1_2D(i_0, 0) then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & array_bytes_to_find_1_2D(i_0, 0) b_exit_while_1 = TRUE i_byte_check = i_byte_check + 1 ' i_byte_check = 1 i_0 = i_0 - 1 end if i_0 = i_0 + 1 wend ' Si il ne correspond pas, l'octet est traité, ' c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. if b_exit_while_1 = FALSE then file_output.Write(chr(array_byte_buffer_1(i_byte_check))) ' Si le buffer contient plusieurs cases, ' on les décale vers l'arrière et on le raccourcit d'une case. if ubound(array_byte_buffer_1) >= 1 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if wend ' break case 1 ' Deuxième boucle de vérification. ' On compare le 2ème octet (i_byte_check = 1) du buffer ' aux octets stockés dans les cases de la 1ère dimension du 2ème tableau. b_exit_while_1 = FALSE i_1 = 0 while i_1 <= array_bytes_to_find_2_2D_ubound AND b_exit_while_1 = FALSE ' Si il correspond à une case, ' on compare la 2ème dimension de la case du 1er tableau précédent ' à la 2ème dimension de cette case de ce 2ème tableau et ' on stocke les numéros communs dans un tableau : array_match_found_1. if array_byte_buffer_1(i_byte_check) = array_bytes_to_find_2_2D(i_1, 0) then b_exit_while_1 = TRUE redim array_match_found_1(-1) i_0_2D = 1 b_exit_while_2 = FALSE while i_0_2D <= ubound(array_bytes_to_find_1_2D, 2) AND b_exit_while_2 = FALSE if array_bytes_to_find_1_2D(i_0, i_0_2D) <> "" then i_1_2D = 1 b_exit_while_3 = FALSE while i_1_2D <= ubound(array_bytes_to_find_2_2D, 2) AND b_exit_while_3 = FALSE if array_bytes_to_find_2_2D(i_1, i_1_2D) <> "" then if array_bytes_to_find_1_2D(i_0, i_0_2D) = array_bytes_to_find_2_2D(i_1, i_1_2D) then redim preserve array_match_found_1(ubound(array_match_found_1) + 1) array_match_found_1(ubound(array_match_found_1)) = array_bytes_to_find_1_2D(i_0, i_0_2D) end if i_1_2D = i_1_2D + 1 else b_exit_while_3 = TRUE end if wend i_0_2D = i_0_2D + 1 else b_exit_while_2 = TRUE end if wend ' Si le tableau n'est pas vide, il indique le ou les numéros ' des chaînes qui commencent par ces 2 octets. Dans ce cas : ' l'écriture du fichier de sortie reste suspendue (i_byte_check ≠ 0) ' et les octets restent stockés dans le buffer. if ubound(array_match_found_1) >= 0 then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & array_bytes_to_find_2_2D(i_1, 0) ' WScript.Echo "Les octets du buffer """ & join(array_byte_buffer_1, " ") & """ doivent commencer la/les chaîne(s) """ & join(array_match_found_1, " ") & """" i_byte_check = i_byte_check + 1 ' i_byte_check = 2 end if ' Si le tableau est vide, les 2 octets ne correspondent ' à aucune chaîne à rechercher. C'est la même situation que ' si le 2ème octet ne correspond à aucune case du 2ème tableau. end if i_1 = i_1 + 1 wend ' Si il ne correspond pas, le premier octet est traité, ' c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. ' De plus i_byte_check est réinitialisée donc on retourne ' à la première boucle de vérification pour vider le buffer. if b_exit_while_1 = FALSE OR ubound(array_match_found_1) < 0 then i_byte_check = 0 file_output.Write(chr(array_byte_buffer_1(i_byte_check))) ' Si le buffer contient plusieurs cases, ' on les décale vers l'arrière et on le raccourcit d'une case. if ubound(array_byte_buffer_1) >= 1 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if ' break case 2 ' Troisième boucle de vérification. ' On compare le 3ème octet (i_byte_check = 2) du buffer ' aux octets stockés dans les cases de la 1ère dimension du 3ème tableau. b_exit_while_1 = FALSE i_2 = 0 while i_2 <= array_bytes_to_find_3_2D_ubound AND b_exit_while_1 = FALSE ' Si il correspond à une case, ' on compare le tableau précédent array_match_found_1 ' à la 2ème dimension de cette case de ce 3ème tableau et ' on stocke les numéros communs dans array_match_found_1 ' par l'intermédiaire d'un tableau temporaire : array_match_found_2. if array_byte_buffer_1(i_byte_check) = array_bytes_to_find_3_2D(i_2, 0) then b_exit_while_1 = TRUE redim array_match_found_2(-1) i_1_2D = 0 b_exit_while_2 = FALSE while i_1_2D <= ubound(array_match_found_1) AND b_exit_while_2 = FALSE if array_match_found_1(i_1_2D) <> "" then i_2_2D = 1 b_exit_while_3 = FALSE while i_2_2D <= ubound(array_bytes_to_find_3_2D, 2) AND b_exit_while_3 = FALSE if array_bytes_to_find_3_2D(i_2, i_2_2D) <> "" then if array_match_found_1(i_1_2D) = array_bytes_to_find_3_2D(i_2, i_2_2D) then redim preserve array_match_found_2(ubound(array_match_found_2) + 1) array_match_found_2(ubound(array_match_found_2)) = array_match_found_1(i_1_2D) end if i_2_2D = i_2_2D + 1 else b_exit_while_3 = TRUE end if wend i_1_2D = i_1_2D + 1 else b_exit_while_2 = TRUE end if wend redim array_match_found_1(ubound(array_match_found_2)) for i = 0 to ubound(array_match_found_2) array_match_found_1(i) = array_match_found_2(i) next ' Si le tableau n'est pas vide, il indique le ou les numéros ' des chaînes qui commencent par ces 3 octets. Dans ce cas : ' l'écriture du fichier de sortie reste suspendue (i_byte_check ≠ 0) ' et les octets restent stockés dans le buffer. if ubound(array_match_found_1) >= 0 then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & array_bytes_to_find_3_2D(i_2, 0) ' WScript.Echo "Les octets du buffer """ & join(array_byte_buffer_1, " ") & """ doivent commencer la/les chaîne(s) """ & join(array_match_found_1, " ") & """" i_byte_check = i_byte_check + 1 ' i_byte_check = 3 end if ' Si le tableau est vide, les 3 octets ne correspondent ' à aucune chaîne à rechercher. C'est la même situation que ' si le 3ème octet ne correspond à aucune case du 3ème tableau. end if i_2 = i_2 + 1 wend ' Si il ne correspond pas, le premier octet est traité, ' c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. ' De plus i_byte_check est réinitialisée donc on retourne ' à la première boucle de vérification pour vider le buffer. if b_exit_while_1 = FALSE OR ubound(array_match_found_1) < 0 then i_byte_check = 0 file_output.Write(chr(array_byte_buffer_1(i_byte_check))) ' Si le buffer contient plusieurs cases, ' on les décale vers l'arrière et on le raccourcit d'une case. if ubound(array_byte_buffer_1) >= 1 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if ' break case 3 b_exit_while_1 = FALSE i_3 = 0 while i_3 <= array_bytes_to_find_4_2D_ubound AND b_exit_while_1 = FALSE if array_byte_buffer_1(i_byte_check) = array_bytes_to_find_4_2D(i_3, 0) then b_exit_while_1 = TRUE redim array_match_found_2(-1) i_2_2D = 0 b_exit_while_2 = FALSE while i_2_2D <= ubound(array_match_found_1) AND b_exit_while_2 = FALSE if array_match_found_1(i_2_2D) <> "" then i_3_2D = 1 b_exit_while_3 = FALSE while i_3_2D <= ubound(array_bytes_to_find_4_2D, 2) AND b_exit_while_3 = FALSE if array_bytes_to_find_4_2D(i_3, i_3_2D) <> "" then if array_match_found_1(i_2_2D) = array_bytes_to_find_4_2D(i_3, i_3_2D) then redim preserve array_match_found_2(ubound(array_match_found_2) + 1) array_match_found_2(ubound(array_match_found_2)) = array_match_found_1(i_2_2D) end if i_3_2D = i_3_2D + 1 else b_exit_while_3 = TRUE end if wend i_2_2D = i_2_2D + 1 else b_exit_while_2 = TRUE end if wend redim array_match_found_1(ubound(array_match_found_2)) for i = 0 to ubound(array_match_found_2) array_match_found_1(i) = array_match_found_2(i) next if ubound(array_match_found_1) >= 0 then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & array_bytes_to_find_4_2D(i_3, 0) ' WScript.Echo "Les octets du buffer """ & join(array_byte_buffer_1, " ") & """ doivent commencer la/les chaîne(s) """ & join(array_match_found_1, " ") & """" i_byte_check = i_byte_check + 1 ' i_byte_check = 4 end if end if i_3 = i_3 + 1 wend if b_exit_while_1 = FALSE OR ubound(array_match_found_1) < 0 then i_byte_check = 0 file_output.Write(chr(array_byte_buffer_1(i_byte_check))) if ubound(array_byte_buffer_1) >= 1 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if ' break case 4 b_exit_while_1 = FALSE i_4 = 0 while i_4 <= array_bytes_to_find_5_2D_ubound AND b_exit_while_1 = FALSE if array_byte_buffer_1(i_byte_check) = array_bytes_to_find_5_2D(i_4, 0) then b_exit_while_1 = TRUE redim array_match_found_2(-1) i_3_2D = 0 b_exit_while_2 = FALSE while i_3_2D <= ubound(array_match_found_1) AND b_exit_while_2 = FALSE if array_match_found_1(i_3_2D) <> "" then i_4_2D = 1 b_exit_while_3 = FALSE while i_4_2D <= ubound(array_bytes_to_find_5_2D, 2) AND b_exit_while_3 = FALSE if array_bytes_to_find_5_2D(i_4, i_4_2D) <> "" then if array_match_found_1(i_3_2D) = array_bytes_to_find_5_2D(i_4, i_4_2D) then redim preserve array_match_found_2(ubound(array_match_found_2) + 1) array_match_found_2(ubound(array_match_found_2)) = array_match_found_1(i_3_2D) end if i_4_2D = i_4_2D + 1 else b_exit_while_3 = TRUE end if wend i_3_2D = i_3_2D + 1 else b_exit_while_2 = TRUE end if wend redim array_match_found_1(ubound(array_match_found_2)) for i = 0 to ubound(array_match_found_2) array_match_found_1(i) = array_match_found_2(i) next if ubound(array_match_found_1) >= 0 then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & array_bytes_to_find_5_2D(i_4, 0) ' WScript.Echo "Les octets du buffer """ & join(array_byte_buffer_1, " ") & """ doivent commencer la/les chaîne(s) """ & join(array_match_found_1, " ") & """" i_byte_check = i_byte_check + 1 ' i_byte_check = 5 end if end if i_4 = i_4 + 1 wend if b_exit_while_1 = FALSE OR ubound(array_match_found_1) < 0 then i_byte_check = 0 file_output.Write(chr(array_byte_buffer_1(i_byte_check))) if ubound(array_byte_buffer_1) >= 2 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if ' break case else ' On prend le tableau array_match_found_1, il contient le ' (ou les) numéro de case du tableau array_hex_strings_to_find ' qui lui-même contient la chaîne complète des octets à analyser ' dont les 5 premiers octets correspondent. ' Remarque : il se peut que plusieurs chaînes aient leurs 5 premiers ' octets en commun. Voire que seul le dernier octet soit différent. ' Donc on analyse chaque case du tableau array_match_found_1. b_exit_while_1 = FALSE i_5 = 0 ' (Inutile car i_5 reste à 0) while i_5 <= ubound(array_match_found_1) AND b_exit_while_1 = FALSE ' On analyse la chaîne contenue dans array_hex_strings_to_find. ' Si la chaîne continue à correspondre, on teste l'octet suivant. if string(2 - len(hex(array_byte_buffer_1(i_byte_check))), "0") & ucase((hex(array_byte_buffer_1(i_byte_check)))) = mid(array_hex_strings_to_find(array_match_found_1(i_5)), 2 * i_byte_check + 1, 2) then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & mid(array_hex_strings_to_find(array_match_found_1(i_5)), 2 * i_byte_check + 1, 2) b_exit_while_1 = TRUE i_byte_check = i_byte_check + 1 ' Si la chaîne ne correspond plus, alors on retire son numéro du tableau array_match_found_1. ' Et si le tableau est vide, alors aucune chaîne ne correspondait, ' donc le premier octet est traité et i_byte_check est réinitialisée. else if ubound(array_match_found_1) >= 1 then redim array_match_found_2(ubound(array_match_found_1) - 1) for i = 1 to ubound(array_match_found_1) array_match_found_2(i - 1) = array_match_found_1(i) next redim array_match_found_1(ubound(array_match_found_2)) for i = 0 to ubound(array_match_found_2) array_match_found_1(i) = array_match_found_2(i) next else redim array_match_found_1(-1) i_byte_check = 0 file_output.Write(chr(array_byte_buffer_1(i_byte_check))) if ubound(array_byte_buffer_1) >= 1 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if end if if i_byte_check > 0 then ' Si la correspondance va jusqu'au bout de la chaîne, alors la chaîne a été détectée. if i_byte_check = len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2 then ' Dans ce cas on écrit la nouvelle chaîne et on vide le buffer. for i = 0 to len(array_hex_strings_to_replace(array_match_found_1(i_5))) - 1 step 2 file_output.Write(chr(cbyte("&H" & Mid(array_hex_strings_to_replace(array_match_found_1(i_5)), i + 1, 2)))) next ' WScript.Echo vbCrLf & "Contenu de la chaîne n°" & array_match_found_1(i_5) + 1 & " (" & len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2 & " cases) : " & array_hex_strings_to_find(array_match_found_1(i_5)) & vbCrLf & "Contenu du buffer (" & ubound(array_byte_buffer_1) + 1 & " cases) : " & join(array_byte_buffer_1, " ") ' On vide le buffer de la chaîne à rechercher. if ubound(array_byte_buffer_1) >= len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - (len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2)) for i = len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2 to ubound(array_byte_buffer_1) step 1 array_byte_buffer_2(i - len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next ' WScript.Echo "Contenu restant du buffer = : " & join(array_byte_buffer_1, " ") else redim array_byte_buffer_1(-1) end if i_byte_check = 0 i_replacement_count = i_replacement_count + 1 ' WScript.Echo vbCrLf & "Fichier :" & vbCrLf & file_fullname & vbCrLf & "Séquence n°" & array_match_found_1(i_5) + 1 & " trouvée :" & vbCrLf & array_hex_strings_to_find(array_match_found_1(i_5)) & vbCrLf & "Remplacée par :" & vbCrLf & array_hex_strings_to_replace(array_match_found_1(i_5)) & vbCrLf end if end if wend end select loop file_input.Close file_output.Close i_my_replace_array_hex_strings_in_file = i_replacement_count end function Function i_my_rename_file(byval file_fullname, byval file_fullname_new) if object_file_system.FileExists(file_fullname) = FALSE then MsgBox "Erreur, le fichier :" & vbCrLf & file_fullname & vbCrLf & "n'existe pas, impossible de le renommer en :" & vbCrLf & file_fullname_new, 48, "Erreur" WScript.Quit(0) end if ' WScript.Echo "Le fichier :" & vbCrLf & file_fullname & vbCrLf & "a été renommé en :" & vbCrLf & file_fullname_new & vbCrLf object_file_system.MoveFile file_fullname, file_fullname_new if object_file_system.FileExists(file_fullname_new) = FALSE then MsgBox "Erreur, le fichier :" & vbCrLf & file_fullname & vbCrLf & "n'a pas pu être renommé.", 48, "Erreur" WScript.Quit(0) end if i_my_rename_file = 0 end function function i_my_fix_corrupted_file(byval corrupted_file_error_ori, byval corrupted_file_error_fix, byval corrupted_file) i_installation_type = 0 if program_folder <> "" then if object_file_system.FileExists(program_folder & "\" & corrupted_file) = FALSE then MsgBox "Erreur, fichier non détecté :" & vbCrLf & program_folder & "\" & corrupted_file, 48, "Erreur" WScript.Quit(0) end if i_installation_type = 1 WScript.Echo "Fichier détecté :" & vbCrLf & program_folder & "\" & corrupted_file & vbCrLf end if if object_file_system.FileExists(program_folder_portable_32 & "\" & corrupted_file) = TRUE then i_installation_type = 2 WScript.Echo "Fichier détecté :" & vbCrLf & program_folder_portable_32 & "\" & corrupted_file & vbCrLf end if if object_file_system.FileExists(program_folder_portable_64 & "\" & corrupted_file) = TRUE then i_installation_type = i_installation_type + 3 WScript.Echo "Fichier détecté :" & vbCrLf & program_folder_portable_64 & "\" & corrupted_file & vbCrLf end if if object_file_system.FileExists(program_folder_installed_32 & "\" & corrupted_file) = TRUE then i_installation_type = 6 WScript.Echo "Fichier détecté :" & vbCrLf & program_folder_installed_32 & "\" & corrupted_file & vbCrLf end if if object_file_system.FileExists(program_folder_installed_64 & "\" & corrupted_file) = TRUE then i_installation_type = 7 WScript.Echo "Fichier détecté :" & vbCrLf & program_folder_installed_64 & "\" & corrupted_file & vbCrLf end if if i_installation_type = 0 then MsgBox "Erreur, aucun fichier détecté.", 48, "Erreur" WScript.Quit(0) end if if i_installation_type = 1 then if object_file_system.FileExists(program_folder & "\" & corrupted_file & ".bak") = TRUE then user_response = MsgBox("Attention, le fichier de sauvegarde :" & vbCrLf & program_folder & "\" & corrupted_file & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "appuyez sur ""Oui"" pour supprimer le fichier "".bak"" et continuer," & vbCrLf & "sinon appuyez sur ""Non"" pour quitter." & vbCrLf _ & "Voulez-vous continuer ?", 292, "Question") ' 4 = vbYesNo 32 = vbQuestion 256 = vbDefaultButton2 0 = vbApplicationModal if user_response <> "6" then WScript.Quit(0) end if object_file_system.DeleteFile program_folder & "\" & corrupted_file & ".bak", TRUE WScript.Echo "Le fichier :" & vbCrLf & program_folder & "\" & corrupted_file & ".bak" & vbCrLf & "a été supprimé." end if number_of_replacements = i_my_replace_array_hex_strings_in_file(corrupted_file_error_ori, corrupted_file_error_fix, program_folder & "\" & corrupted_file) WScript.Echo vbCrLf & vbCrLf & number_of_replacements & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & program_folder & "\" & corrupted_file & vbCrLf i_my_rename_file program_folder & "\" & corrupted_file, program_folder & "\" & corrupted_file & ".bak" i_my_rename_file program_folder & "\" & corrupted_file & ".temporary", program_folder & "\" & corrupted_file end if if i_installation_type = 2 OR i_installation_type = 5 then if object_file_system.FileExists(program_folder_portable_32 & "\" & corrupted_file & ".bak") = TRUE then user_response = MsgBox("Attention, le fichier de sauvegarde :" & vbCrLf & program_folder_portable_32 & "\" & corrupted_file & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "appuyez sur ""Oui"" pour supprimer le fichier "".bak"" et continuer," & vbCrLf & "sinon appuyez sur ""Non"" pour quitter." & vbCrLf _ & "Voulez-vous continuer ?", 292, "Question") if user_response <> "6" then WScript.Quit(0) end if object_file_system.DeleteFile program_folder_portable_32 & "\" & corrupted_file & ".bak", TRUE WScript.Echo "Le fichier :" & vbCrLf & program_folder_portable_32 & "\" & corrupted_file & ".bak" & vbCrLf & "a été supprimé." end if number_of_replacements = i_my_replace_array_hex_strings_in_file(corrupted_file_error_ori, corrupted_file_error_fix, program_folder_portable_32 & "\" & corrupted_file) WScript.Echo vbCrLf & vbCrLf & number_of_replacements & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & program_folder_portable_32 & "\" & corrupted_file & vbCrLf i_my_rename_file program_folder_portable_32 & "\" & corrupted_file, program_folder_portable_32 & "\" & corrupted_file & ".bak" i_my_rename_file program_folder_portable_32 & "\" & corrupted_file & ".temporary", program_folder_portable_32 & "\" & corrupted_file end if if i_installation_type = 3 OR i_installation_type = 5 then if object_file_system.FileExists(program_folder_portable_64 & "\" & corrupted_file_1 & ".bak") = TRUE then user_response = MsgBox("Attention, le fichier de sauvegarde :" & vbCrLf & program_folder_portable_64 & "\" & corrupted_file & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "appuyez sur ""Oui"" pour supprimer le fichier "".bak"" et continuer," & vbCrLf & "sinon appuyez sur ""Non"" pour quitter." & vbCrLf _ & "Voulez-vous continuer ?", 292, "Question") if user_response <> "6" then WScript.Quit(0) end if object_file_system.DeleteFile program_folder_portable_64 & "\" & corrupted_file & ".bak", TRUE WScript.Echo "Le fichier :" & vbCrLf & program_folder_portable_64 & "\" & corrupted_file & ".bak" & vbCrLf & "a été supprimé." end if number_of_replacements = i_my_replace_array_hex_strings_in_file(corrupted_file_error_ori, corrupted_file_error_fix, program_folder_portable_64 & "\" & corrupted_file) WScript.Echo vbCrLf & vbCrLf & number_of_replacements & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & program_folder_portable_64 & "\" & corrupted_file & vbCrLf i_my_rename_file program_folder_portable_64 & "\" & corrupted_file, program_folder_portable_64 & "\" & corrupted_file & ".bak" i_my_rename_file program_folder_portable_64 & "\" & corrupted_file & ".temporary", program_folder_portable_64 & "\" & corrupted_file end if if i_installation_type = 6 then if object_file_system.FileExists(program_folder_installed_32 & "\" & corrupted_file_1 & ".bak") = TRUE then user_response = MsgBox("Attention, le fichier de sauvegarde :" & vbCrLf & program_folder_installed_32 & "\" & corrupted_file & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "appuyez sur ""Oui"" pour supprimer le fichier "".bak"" et continuer," & vbCrLf & "sinon appuyez sur ""Non"" pour quitter." & vbCrLf _ & "Voulez-vous continuer ?", 292, "Question") if user_response <> "6" then WScript.Quit(0) end if object_file_system.DeleteFile program_folder_installed_32 & "\" & corrupted_file & ".bak", TRUE WScript.Echo "Le fichier :" & vbCrLf & program_folder_installed_32 & "\" & corrupted_file & ".bak" & vbCrLf & "a été supprimé." end if number_of_replacements = i_my_replace_array_hex_strings_in_file(corrupted_file_error_ori, corrupted_file_error_fix, program_folder_installed_32 & "\" & corrupted_file) WScript.Echo vbCrLf & vbCrLf & number_of_replacements & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & program_folder_installed_32 & "\" & corrupted_file & vbCrLf i_my_rename_file program_folder_installed_32 & "\" & corrupted_file, program_folder_installed_32 & "\" & corrupted_file & ".bak" i_my_rename_file program_folder_installed_32 & "\" & corrupted_file & ".temporary", program_folder_installed_32 & "\" & corrupted_file end if if i_installation_type = 7 then if object_file_system.FileExists(program_folder_installed_64 & "\" & corrupted_file_1 & ".bak") = TRUE then user_response = MsgBox("Attention, le fichier de sauvegarde :" & vbCrLf & program_folder_installed_64 & "\" & corrupted_file & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "appuyez sur ""Oui"" pour supprimer le fichier "".bak"" et continuer," & vbCrLf & "sinon appuyez sur ""Non"" pour quitter." & vbCrLf _ & "Voulez-vous continuer ?", 292, "Question") if user_response <> "6" then WScript.Quit(0) end if object_file_system.DeleteFile program_folder_installed_64 & "\" & corrupted_file & ".bak", TRUE WScript.Echo "Le fichier :" & vbCrLf & program_folder_installed_64 & "\" & corrupted_file & ".bak" & vbCrLf & "a été supprimé." end if number_of_replacements = i_my_replace_array_hex_strings_in_file(corrupted_file_error_ori, corrupted_file_error_fix, program_folder_installed_64 & "\" & corrupted_file) WScript.Echo vbCrLf & vbCrLf & number_of_replacements & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & program_folder_installed_64 & "\" & corrupted_file & vbCrLf i_my_rename_file program_folder_installed_64 & "\" & corrupted_file, program_folder_installed_64 & "\" & corrupted_file & ".bak" i_my_rename_file program_folder_installed_64 & "\" & corrupted_file & ".temporary", program_folder_installed_64 & "\" & corrupted_file end if i_my_fix_corrupted_file = number_of_replacements end function ' _____________________________________________________________________________ ' Partie à modifier pour ajouter des fichiers à corriger : ' Lancement du script : number_of_replacements = i_my_fix_corrupted_file(corrupted_file_1_error_ori, corrupted_file_1_error_fix, corrupted_file_1) ' _____________________________________________________________________________ ' Partie à ne pas modifier : pause_message = "L'exécution de ce programme est terminée." MsgBox pause_message & vbCrLf & vbCrLf & "Appuyez sur une touche pour continuer...", 64, "Pause" ' 0 = vbOKOnly vbDefaultButton1 vbApplicationModal 64 = vbInformation WScript.Quit(0) Firefox en Powershell # Character encoding = UTF-16 LE (Byte Order Mark = FF FE) # End-of-line = Windows (CR LF) # Composants requis : $current_folder = $PWD.Path # _____________________________________________________________________________ # Partie à modifier pour ajouter des fichiers et erreurs à corriger : # Emplacement personnalisé du dossier contenant le fichier "firefox.exe". # Vous pouvez le laisser vide. Exemple : # $program_folder = "$current_folder\Mozilla Firefox" $program_folder = "" # Emplacements connus : $program_folder_portable_32 = "$current_folder\App\Firefox" $program_folder_portable_64 = "$current_folder\App\Firefox64" $program_folder_installed_32 = "${env:ProgramFiles(x86)}\Mozilla Firefox" $program_folder_installed_64 = "${$env:ProgramFiles}\Mozilla Firefox" # Fichier(s) à réparer : $corrupted_file_1 = "omni.ja" $corrupted_file_2 = "browser\omni.ja" # Réparations à faire : $corrupted_file_1_error_ori = @() $corrupted_file_1_error_fix = @() # utilisateur·trice => utilisateur $corrupted_file_1_error_ori += "C2B774726963650A" # ·trice $corrupted_file_1_error_fix += "0A0A0A0A0A0A0A0A" # $corrupted_file_2_error_ori = @() $corrupted_file_2_error_fix = @() # administrateur·trice a désactivé la synchronisation. => administrateur a désactivé la synchronisation. $corrupted_file_2_error_ori += "C2B7747269636520612064C3A9736163746976C3A9206C612073796E6368726F6E69736174696F6E2E0A" # ·trice a désactivé la synchronisation. $corrupted_file_2_error_fix += "20612064C3A9736163746976C3A9206C612073796E6368726F6E69736174696F6E2E0A0A0A0A0A0A0A0A" # a désactivé la synchronisation. # connecté·e. => connecté. $corrupted_file_2_error_ori += "C3A9C2B7652E0A" # é·e. $corrupted_file_2_error_fix += "C3A92E0A0A0A0A" # é. # connecté·e avec succès => connecté avec succès $corrupted_file_2_error_ori += "C2B76520617665632073756363C3A8730A" # ·e avec succès $corrupted_file_2_error_fix += "20617665632073756363C3A8730A0A0A0A" # avec succès # suivi·e => suivi $corrupted_file_2_error_ori += "7669C2B7650A" # vi·e $corrupted_file_2_error_fix += "76690A0A0A0A" # vi # Prêt·e à scanner</strong> et maintenez votre appareil au-dessus de ce code => Prêt à scanner</strong> et maintenez votre appareil au-dessus de ce code $corrupted_file_2_error_ori += "C2B76520C3A0207363616E6E65723C2F7374726F6E673E206574206D61696E74656E657A20766F74726520617070617265696C2061752D64657373757320646520636520636F64650A" # ·e à scanner</strong> et maintenez votre appareil au-dessus de ce code $corrupted_file_2_error_fix += "20C3A0207363616E6E65723C2F7374726F6E673E206574206D61696E74656E657A20766F74726520617070617265696C2061752D64657373757320646520636520636F64650A0A0A0A" # à scanner</strong> et maintenez votre appareil au-dessus de ce code # pisté·e => pisté $corrupted_file_2_error_ori += "C3A9C2B7650A" # é·e $corrupted_file_2_error_fix += "C3A90A0A0A0A" # é # véritables client·e·s qui ont laissé des avis sincères et objectifs. $corrupted_file_2_error_ori += "C2B765C2B77320717569206F6E74206C61697373C3A92064657320617669732073696E63C3A8726573206574206F626A6563746966732E0A" # ·e·s qui ont laissé des avis sincères et objectifs. $corrupted_file_2_error_fix += "7320717569206F6E74206C61697373C3A92064657320617669732073696E63C3A8726573206574206F626A6563746966732E0A0A0A0A0A0A" # s qui ont laissé des avis sincères et objectifs. # _____________________________________________________________________________ # Partie à ne pas modifier : function i_my_replace_array_hex_strings_in_file([string[]]$array_hex_strings_to_find, [string[]]$array_hex_strings_to_replace, [string]$file_fullname) { if ($array_hex_strings_to_find.GetUpperBound(0) -ne $array_hex_strings_to_replace.GetUpperBound(0)) { Write-Host "Erreur :`r`nLe nombre de cases dans le tableau des chaînes hexadécimales à détecter ($($array_hex_strings_to_find.GetUpperBound(0) + 1))`r`net dans le tableau des chaînes hexadécimales à remplacer ($($array_hex_strings_to_replace.GetUpperBound(0) + 1))`r`nn'est pas identique." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) # Si le buffer n'est pas vide, au cas où une touche aurait déjà été pressée. { while ($Host.UI.RawUI.KeyAvailable -eq $true) # Vide le buffer et met en pause. { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") # Met en pause. } exit 0 } for ($i = 0; $i -le $array_hex_strings_to_find.GetUpperBound(0); $i++) { if ($array_hex_strings_to_find[$i].Length -ne $array_hex_strings_to_replace[$i].Length) { Write-Host "Erreur :`r`nLa variable $($array_hex_strings_to_find[$i]) et`r`nla variable $($array_hex_strings_to_replace[$i])" Write-Host "n'ont pas le même nombre de caractères ($($array_hex_strings_to_find[$i].Length) contre $($array_hex_strings_to_replace[$i].Length))." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } if ($array_hex_strings_to_find[$i].Length % 2 -ne 0) { Write-Host "Erreur, les variables :`r`n$($array_hex_strings_to_find[$i]) et`r`n$($array_hex_strings_to_replace[$i])`r`nont un nombre impair de caractères." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } if ($array_hex_strings_to_find[$i].Length -lt 12) { Write-Host "Erreur, les variables :`r`n$($array_hex_strings_to_find[$i]) et`r`n$($array_hex_strings_to_replace[$i])" Write-Host "doivent avoir au moins 12 caractères hexadécimaux pour représenter" Write-Host "au moins 6 octets. Or ici, elles n'en contiennent que $($array_hex_strings_to_find[$i].Length)." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } } Out-File -FilePath "$file_fullname.temporary" -Force -Encoding ASCII # (Force = Écraser si existe déjà) (Encoding ASCII = Utiliser ASCII au lieu d'Unicode UTF16LE donc pas de Byte Order Mark FFFE) if ((Test-Path "$file_fullname.temporary") -eq $false) { Write-Host "Erreur, le fichier :`r`n$file_fullname.temporary" Write-Host "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } # Pour aller plus vite, on crée 5 tableaux en 2 dimensions. # Nous sommes obligés de créer chaque dimension indépendamment car # il est impossible de redimensionner dynamiquement les 2 dimensions. # Concernant la 1ère dimension : # Le 1er tableau contiendra les premiers octets de toutes les chaînes # à rechercher, convertis en décimal et en éliminant les doublons. # Le 2ème tableau contiendra les deuxièmes octets, etc. # Le 3ème tableau contiendra les troisièmes octets, etc. $array_bytes_to_find_1 = @() $array_bytes_to_find_2 = @() $array_bytes_to_find_3 = @() $array_bytes_to_find_4 = @() $array_bytes_to_find_5 = @() for ($i_1 = 0; $i_1 -le $array_hex_strings_to_find.GetUpperBound(0); $i_1++) { $b_already_exists = $false for ($i_2 = 0; $i_2 -le $array_bytes_to_find_1.GetUpperBound(0); $i_2++) { if ([Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(0, 2), 16) -eq $array_bytes_to_find_1[$i_2]) { $b_already_exists = $true } } if ($b_already_exists -eq $false) { $array_bytes_to_find_1 += [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(0, 2), 16) } $b_already_exists = $false for ($i_2 = 0; $i_2 -le $array_bytes_to_find_2.GetUpperBound(0); $i_2++) { if ([Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(2, 2), 16) -eq $array_bytes_to_find_2[$i_2]) { $b_already_exists = $true } } if ($b_already_exists -eq $false) { $array_bytes_to_find_2 += [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(2, 2), 16) } $b_already_exists = $false for ($i_2 = 0; $i_2 -le $array_bytes_to_find_3.GetUpperBound(0); $i_2++) { if ([Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(4, 2), 16) -eq $array_bytes_to_find_3[$i_2]) { $b_already_exists = $true } } if ($b_already_exists -eq $false) { $array_bytes_to_find_3 += [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(4, 2), 16) } $b_already_exists = $false for ($i_2 = 0; $i_2 -le $array_bytes_to_find_4.GetUpperBound(0); $i_2++) { if ([Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(6, 2), 16) -eq $array_bytes_to_find_4[$i_2]) { $b_already_exists = $true } } if ($b_already_exists -eq $false) { $array_bytes_to_find_4 += [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(6, 2), 16) } $b_already_exists = $false for ($i_2 = 0; $i_2 -le $array_bytes_to_find_5.GetUpperBound(0); $i_2++) { if ([Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(8, 2), 16) -eq $array_bytes_to_find_5[$i_2]) { $b_already_exists = $true } } if ($b_already_exists -eq $false) { $array_bytes_to_find_5 += [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(8, 2), 16) } } # Concernant la 2ème dimension : # Pour chaque tableau, elle contiendra les numéros des chaînes # auxquelles les octets correspondent (en commençant par 0). # Imaginons que la 1ère case du 1er tableau contient l'octet C2 = 194 # et que plusieurs chaînes commencent par C2 (doublons), par exemple # les chaînes 1 2 4 5 6, alors les chiffres 0 1 3 4 5 seront inscrits # dans la 2ème dimension de la 1ère case du 1er tableau. $array_bytes_to_find_1_2D = New-Object 'object[,]' ($array_bytes_to_find_1.GetUpperBound(0) + 1), 1 $array_bytes_to_find_2_2D = New-Object 'object[,]' ($array_bytes_to_find_2.GetUpperBound(0) + 1), 1 $array_bytes_to_find_3_2D = New-Object 'object[,]' ($array_bytes_to_find_3.GetUpperBound(0) + 1), 1 $array_bytes_to_find_4_2D = New-Object 'object[,]' ($array_bytes_to_find_4.GetUpperBound(0) + 1), 1 $array_bytes_to_find_5_2D = New-Object 'object[,]' ($array_bytes_to_find_5.GetUpperBound(0) + 1), 1 for ($i_1 = 0; $i_1 -le $array_bytes_to_find_1_2D.GetUpperBound(0); $i_1++) { $array_bytes_to_find_1_2D[$i_1, 0] = $array_bytes_to_find_1[$i_1] $i_2 = 1 for ($i_3 = 0; $i_3 -le $array_hex_strings_to_find.GetUpperBound(0); $i_3++) { if ([int]::Parse($array_hex_strings_to_find[$i_3].Substring(0, 2), [System.Globalization.NumberStyles]::HexNumber) -eq $array_bytes_to_find_1_2D[$i_1, 0]) { if ($array_bytes_to_find_1_2D.GetUpperBound(1) -lt $i_2) { # En PowerShell il n'existe pas d'équivalent à la commande # ReDim Preserve array_bytes_to_find_1_2D(ubound,ubound+1) # du VBScript pour redimensionner la 2ème dimension du tableau. # La notation "+=" ajoute un élément à la fin d'un tableau, # mais seulement s'il est en 1 dimension, pas en 2 dimensions. # Il faut donc créer un autre tableau $array_subarray_2D # avec une case supplémentaire puis recopier le tableau dedans # en utilisant une boucle for. $array_subarray_2D = New-Object 'object[,]' ($array_bytes_to_find_1_2D.GetUpperBound(0) + 1), ($array_bytes_to_find_1_2D.GetUpperBound(1) + 2) for ($i = 0; $i -le $array_bytes_to_find_1_2D.GetUpperBound(0); $i++) { for ($j = 0; $j -le $array_bytes_to_find_1_2D.GetUpperBound(1); $j++) { $array_subarray_2D[$i, $j] = $array_bytes_to_find_1_2D[$i, $j] } } $array_bytes_to_find_1_2D = $array_subarray_2D Remove-Variable -Name array_subarray_2D } $array_bytes_to_find_1_2D[$i_1, $i_2] = $i_3 $i_2++ } } } for ($i_1 = 0; $i_1 -le $array_bytes_to_find_2_2D.GetUpperBound(0); $i_1++) { $array_bytes_to_find_2_2D[$i_1, 0] = $array_bytes_to_find_2[$i_1] $i_2 = 1 for ($i_3 = 0; $i_3 -le $array_hex_strings_to_find.GetUpperBound(0); $i_3++) { if ([int]::Parse($array_hex_strings_to_find[$i_3].Substring(2, 2), [System.Globalization.NumberStyles]::HexNumber) -eq $array_bytes_to_find_2_2D[$i_1, 0]) { if ($array_bytes_to_find_2_2D.GetUpperBound(1) -lt $i_2) { $array_subarray_2D = New-Object 'object[,]' ($array_bytes_to_find_2_2D.GetUpperBound(0) + 1), ($array_bytes_to_find_2_2D.GetUpperBound(1) + 2) for ($i = 0; $i -le $array_bytes_to_find_2_2D.GetUpperBound(0); $i++) { for ($j = 0; $j -le $array_bytes_to_find_2_2D.GetUpperBound(1); $j++) { $array_subarray_2D[$i, $j] = $array_bytes_to_find_2_2D[$i, $j] } } $array_bytes_to_find_2_2D = $array_subarray_2D Remove-Variable -Name array_subarray_2D } $array_bytes_to_find_2_2D[$i_1, $i_2] = $i_3 $i_2++ } } } for ($i_1 = 0; $i_1 -le $array_bytes_to_find_3_2D.GetUpperBound(0); $i_1++) { $array_bytes_to_find_3_2D[$i_1, 0] = $array_bytes_to_find_3[$i_1] $i_2 = 1 for ($i_3 = 0; $i_3 -le $array_hex_strings_to_find.GetUpperBound(0); $i_3++) { if ([int]::Parse($array_hex_strings_to_find[$i_3].Substring(4, 2), [System.Globalization.NumberStyles]::HexNumber) -eq $array_bytes_to_find_3_2D[$i_1, 0]) { if ($array_bytes_to_find_3_2D.GetUpperBound(1) -lt $i_2) { $array_subarray_2D = New-Object 'object[,]' ($array_bytes_to_find_3_2D.GetUpperBound(0) + 1), ($array_bytes_to_find_3_2D.GetUpperBound(1) + 2) for ($i = 0; $i -le $array_bytes_to_find_3_2D.GetUpperBound(0); $i++) { for ($j = 0; $j -le $array_bytes_to_find_3_2D.GetUpperBound(1); $j++) { $array_subarray_2D[$i, $j] = $array_bytes_to_find_3_2D[$i, $j] } } $array_bytes_to_find_3_2D = $array_subarray_2D Remove-Variable -Name array_subarray_2D } $array_bytes_to_find_3_2D[$i_1, $i_2] = $i_3 $i_2++ } } } for ($i_1 = 0; $i_1 -le $array_bytes_to_find_4_2D.GetUpperBound(0); $i_1++) { $array_bytes_to_find_4_2D[$i_1, 0] = $array_bytes_to_find_4[$i_1] $i_2 = 1 for ($i_3 = 0; $i_3 -le $array_hex_strings_to_find.GetUpperBound(0); $i_3++) { if ([int]::Parse($array_hex_strings_to_find[$i_3].Substring(6, 2), [System.Globalization.NumberStyles]::HexNumber) -eq $array_bytes_to_find_4_2D[$i_1, 0]) { if ($array_bytes_to_find_4_2D.GetUpperBound(1) -lt $i_2) { $array_subarray_2D = New-Object 'object[,]' ($array_bytes_to_find_4_2D.GetUpperBound(0) + 1), ($array_bytes_to_find_4_2D.GetUpperBound(1) + 2) for ($i = 0; $i -le $array_bytes_to_find_4_2D.GetUpperBound(0); $i++) { for ($j = 0; $j -le $array_bytes_to_find_4_2D.GetUpperBound(1); $j++) { $array_subarray_2D[$i, $j] = $array_bytes_to_find_4_2D[$i, $j] } } $array_bytes_to_find_4_2D = $array_subarray_2D Remove-Variable -Name array_subarray_2D } $array_bytes_to_find_4_2D[$i_1, $i_2] = $i_3 $i_2++ } } } for ($i_1 = 0; $i_1 -le $array_bytes_to_find_5_2D.GetUpperBound(0); $i_1++) { $array_bytes_to_find_5_2D[$i_1, 0] = $array_bytes_to_find_5[$i_1] $i_2 = 1 for ($i_3 = 0; $i_3 -le $array_hex_strings_to_find.GetUpperBound(0); $i_3++) { if ([int]::Parse($array_hex_strings_to_find[$i_3].Substring(8, 2), [System.Globalization.NumberStyles]::HexNumber) -eq $array_bytes_to_find_5_2D[$i_1, 0]) { if ($array_bytes_to_find_5_2D.GetUpperBound(1) -lt $i_2) { $array_subarray_2D = New-Object 'object[,]' ($array_bytes_to_find_5_2D.GetUpperBound(0) + 1), ($array_bytes_to_find_5_2D.GetUpperBound(1) + 2) for ($i = 0; $i -le $array_bytes_to_find_5_2D.GetUpperBound(0); $i++) { for ($j = 0; $j -le $array_bytes_to_find_5_2D.GetUpperBound(1); $j++) { $array_subarray_2D[$i, $j] = $array_bytes_to_find_5_2D[$i, $j] } } $array_bytes_to_find_5_2D = $array_subarray_2D Remove-Variable -Name array_subarray_2D } $array_bytes_to_find_5_2D[$i_1, $i_2] = $i_3 $i_2++ } } } <# Write-Host "1ers octets à rechercher => Dans les chaînes : " for ($i_1 = 0; $i_1 -le $array_bytes_to_find_1_2D.GetUpperBound(0); $i_1++) { Write-Host -NoNewline "$($array_bytes_to_find_1_2D[$i_1, 0]) => " for ($i_2 = 1; $i_2 -le ($array_bytes_to_find_1_2D.GetUpperBound(1)); $i_2++) { Write-Host -NoNewline "$($array_bytes_to_find_1_2D[$i_1, $i_2])" if ($i_2 + 1 -le $array_bytes_to_find_1_2D.GetUpperBound(1)) { if ($array_bytes_to_find_1_2D[$i_1, $($i_2 + 1)] -ne $null) { Write-Host -NoNewline " " } } } Write-Host } Write-Host "2èmes octets à rechercher => Dans les chaînes : " for ($i_1 = 0; $i_1 -le $array_bytes_to_find_2_2D.GetUpperBound(0); $i_1++) { Write-Host -NoNewline "$($array_bytes_to_find_2_2D[$i_1, 0]) => " for ($i_2 = 1; $i_2 -le ($array_bytes_to_find_2_2D.GetUpperBound(1)); $i_2++) { Write-Host -NoNewline "$($array_bytes_to_find_2_2D[$i_1, $i_2])" if ($i_2 + 1 -le $array_bytes_to_find_2_2D.GetUpperBound(1)) { if ($array_bytes_to_find_2_2D[$i_1, $($i_2 + 1)] -ne $null) { Write-Host -NoNewline " " } } } Write-Host } Write-Host "3èmes octets à rechercher => Dans les chaînes : " for ($i_1 = 0; $i_1 -le $array_bytes_to_find_3_2D.GetUpperBound(0); $i_1++) { Write-Host -NoNewline "$($array_bytes_to_find_3_2D[$i_1, 0]) => " for ($i_2 = 1; $i_2 -le ($array_bytes_to_find_3_2D.GetUpperBound(1)); $i_2++) { Write-Host -NoNewline "$($array_bytes_to_find_3_2D[$i_1, $i_2])" if ($i_2 + 1 -le $array_bytes_to_find_3_2D.GetUpperBound(1)) { if ($array_bytes_to_find_3_2D[$i_1, $($i_2 + 1)] -ne $null) { Write-Host -NoNewline " " } } } Write-Host } Write-Host "4èmes octets à rechercher => Dans les chaînes : " for ($i_1 = 0; $i_1 -le $array_bytes_to_find_4_2D.GetUpperBound(0); $i_1++) { Write-Host -NoNewline "$($array_bytes_to_find_4_2D[$i_1, 0]) => " for ($i_2 = 1; $i_2 -le ($array_bytes_to_find_4_2D.GetUpperBound(1)); $i_2++) { Write-Host -NoNewline "$($array_bytes_to_find_4_2D[$i_1, $i_2])" if ($i_2 + 1 -le $array_bytes_to_find_4_2D.GetUpperBound(1)) { if ($array_bytes_to_find_4_2D[$i_1, $($i_2 + 1)] -ne $null) { Write-Host -NoNewline " " } } } Write-Host } Write-Host "5èmes octets à rechercher => Dans les chaînes : " for ($i_1 = 0; $i_1 -le $array_bytes_to_find_5_2D.GetUpperBound(0); $i_1++) { Write-Host -NoNewline "$($array_bytes_to_find_5_2D[$i_1, 0]) => " for ($i_2 = 1; $i_2 -le ($array_bytes_to_find_5_2D.GetUpperBound(1)); $i_2++) { Write-Host -NoNewline "$($array_bytes_to_find_5_2D[$i_1, $i_2])" if ($i_2 + 1 -le $array_bytes_to_find_5_2D.GetUpperBound(1)) { if ($array_bytes_to_find_5_2D[$i_1, $($i_2 + 1)] -ne $null) { Write-Host -NoNewline " " } } } Write-Host } Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } Write-Host #> Write-Host -NoNewline "`r`nAnalyse en cours... " $file_input = [System.IO.File]::OpenRead($file_fullname) # Ouverture du fichier en lecture $file_output = [System.IO.File]::Create("$file_fullname.temporary") # Ouverture du fichier en écriture $array_bytes_to_find_1_2D_ubound = $array_bytes_to_find_1_2D.GetUpperBound(0) $array_bytes_to_find_2_2D_ubound = $array_bytes_to_find_2_2D.GetUpperBound(0) $array_bytes_to_find_3_2D_ubound = $array_bytes_to_find_3_2D.GetUpperBound(0) $array_bytes_to_find_4_2D_ubound = $array_bytes_to_find_4_2D.GetUpperBound(0) $array_bytes_to_find_5_2D_ubound = $array_bytes_to_find_5_2D.GetUpperBound(0) $array_byte_buffer_1 = @() $array_byte_buffer_2 = @() $array_match_found_1 = @() $array_match_found_2 = @() $byte_buffer_read = New-Object byte[] 1 $byte_read = 0 $i_byte_check = 0 $i_replacement_count = 0 while ($file_input.Read($byte_buffer_read, 0, 1) -ne 0) { $byte_read = $byte_buffer_read[0] # Write-Host "Caractère lu (hexadécimal $($byte_read.ToString("X2")) = décimal $byte_read) : ""$([char]$byte_read)""" # L'octet lu est stocké dans la dernière case d'un tableau (buffer). $array_byte_buffer_1 += $byte_read # Write-Host "Contenu du buffer : $($array_byte_buffer_1 -join " ")" switch ($i_byte_check) { 0 { # On considère que le buffer peut contenir plusieurs octets en attente d'être traités, # c'est-à-dire écrits dans le fichier de sortie s'il n'existe aucune correspondance. # Chaque 1er octet traité disparaît du buffer, dont la taille se réduit. # Lorsque sa taille atteint 0 (GetUpperBound = -1), le buffer est vide, # tous les octets ont été traités. $b_exit_while_1 = $flase while ($array_byte_buffer_1.GetUpperBound(0) -ge 0 -and $b_exit_while_1 -eq $flase) { # Première boucle de vérification. # On compare le 1er octet ($i_byte_check = 0) du buffer # aux octets stockés dans les cases de la 1ère dimension du 1er tableau. $i_0 = 0 while ($i_0 -le $array_bytes_to_find_1_2D_ubound -and $b_exit_while_1 -eq $flase) { # Si il correspond à une case, # l'écriture du fichier de sortie est suspendue ($i_byte_check ≠ 0) # et l'octet reste stocké dans le buffer. if ($array_byte_buffer_1[$i_byte_check] -eq $array_bytes_to_find_1_2D[$i_0, 0]) { # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_bytes_to_find_1_2D[$i_0, 0])" $b_exit_while_1 = $true $i_byte_check++ # $i_byte_check = 1 $i_0-- } $i_0++ } # Si il ne correspond pas, l'octet est traité, # c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. if ($b_exit_while_1 -eq $flase) { $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) # Si le buffer contient plusieurs cases, # on les décale vers l'arrière et on le raccourcit d'une case. if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } } break } 1 { # Deuxième boucle de vérification. # On compare le 2ème octet ($i_byte_check = 1) du buffer # aux octets stockés dans les cases de la 1ère dimension du 2ème tableau. $b_exit_while_1 = $flase $i_1 = 0 while ($i_1 -le $array_bytes_to_find_2_2D_ubound -and $b_exit_while_1 -eq $flase) { # Si il correspond à une case, # on compare la 2ème dimension de la case du 1er tableau précédent # à la 2ème dimension de cette case de ce 2ème tableau et # on stocke les numéros communs dans un tableau : $array_match_found_1. if ($array_byte_buffer_1[$i_byte_check] -eq $array_bytes_to_find_2_2D[$i_1, 0]) { $b_exit_while_1 = $true $array_match_found_1 = @() $i_0_2D = 1 $b_exit_while_2 = $false while ($i_0_2D -le $array_bytes_to_find_1_2D.GetUpperBound(1) -and $b_exit_while_2 -eq $false) { if ($array_bytes_to_find_1_2D[$i_0, $i_0_2D] -ne $null) { $i_1_2D = 1 $b_exit_while_3 = $false while ($i_1_2D -le $array_bytes_to_find_2_2D.GetUpperBound(1) -and $b_exit_while_3 -eq $false) { if ($array_bytes_to_find_2_2D[$i_1, $i_1_2D] -ne $null) { if ($array_bytes_to_find_1_2D[$i_0, $i_0_2D] -eq $array_bytes_to_find_2_2D[$i_1, $i_1_2D]) { $array_match_found_1 += $array_bytes_to_find_1_2D[$i_0, $i_0_2D] } $i_1_2D++ } else { $b_exit_while_3 = $true } } $i_0_2D++ } else { $b_exit_while_2 = $true } } # Si le tableau n'est pas vide, il indique le ou les numéros # des chaînes qui commencent par ces 2 octets. Dans ce cas : # l'écriture du fichier de sortie reste suspendue ($i_byte_check ≠ 0) # et les octets restent stockés dans le buffer. if ($array_match_found_1.GetUpperBound(0) -ge 0) { # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_bytes_to_find_2_2D[$i_1, 0])" # Write-Host "Les octets du buffer ""$($array_byte_buffer_1 -join " ")"" doivent commencer la/les chaîne(s) ""$($array_match_found_1 -join " ")""" $i_byte_check++ # $i_byte_check = 2 } # Si le tableau est vide, les 2 octets ne correspondent # à aucune chaîne à rechercher. C'est la même situation que # si le 2ème octet ne correspond à aucune case du 2ème tableau. } $i_1++ } # Si il ne correspond pas, le premier octet est traité, # c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. # De plus $i_byte_check est réinitialisée donc on retourne # à la première boucle de vérification pour vider le buffer. if ($b_exit_while_1 -eq $flase -or $array_match_found_1.GetUpperBound(0) -lt 0) { $i_byte_check = 0 $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) # Si le buffer contient plusieurs cases, # on les décale vers l'arrière et on le raccourcit d'une case. if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } break } 2 { # Troisième boucle de vérification. # On compare le 3ème octet ($i_byte_check = 2) du buffer # aux octets stockés dans les cases de la 1ère dimension du 3ème tableau. $b_exit_while_1 = $flase $i_2 = 0 while ($i_2 -le $array_bytes_to_find_3_2D_ubound -and $b_exit_while_1 -eq $flase) { # Si il correspond à une case, # on compare le tableau précédent $array_match_found_1 # à la 2ème dimension de cette case de ce 3ème tableau et # on stocke les numéros communs dans $array_match_found_1 # par l'intermédiaire d'un tableau temporaire : $array_match_found_2. if ($array_byte_buffer_1[$i_byte_check] -eq $array_bytes_to_find_3_2D[$i_2, 0]) { $b_exit_while_1 = $true $array_match_found_2 = @() $i_1_2D = 0 $b_exit_while_2 = $false while ($i_1_2D -le $array_match_found_1.GetUpperBound(0) -and $b_exit_while_2 -eq $false) { if ($array_match_found_1[$i_1_2D] -ne $null) { $i_2_2D = 1 $b_exit_while_3 = $false while ($i_2_2D -le $array_bytes_to_find_3_2D.GetUpperBound(1) -and $b_exit_while_3 -eq $false) { if ($array_bytes_to_find_3_2D[$i_2, $i_2_2D] -ne $null) { if ($array_match_found_1[$i_1_2D] -eq $array_bytes_to_find_3_2D[$i_2, $i_2_2D]) { $array_match_found_2 += $array_match_found_1[$i_1_2D] } $i_2_2D++ } else { $b_exit_while_3 = $true } } $i_1_2D++ } else { $b_exit_while_2 = $true } } $array_match_found_1 = $array_match_found_2 # Si le tableau n'est pas vide, il indique le ou les numéros # des chaînes qui commencent par ces 3 octets. Dans ce cas : # l'écriture du fichier de sortie reste suspendue ($i_byte_check ≠ 0) # et les octets restent stockés dans le buffer. if ($array_match_found_1.GetUpperBound(0) -ge 0) { Write-Host -NoNewline "*" # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_bytes_to_find_3_2D[$i_2, 0])" # Write-Host "Les octets du buffer ""$($array_byte_buffer_1 -join " ")"" doivent commencer la/les chaîne(s) ""$($array_match_found_1 -join " ")""" $i_byte_check++ # $i_byte_check = 3 } # Si le tableau est vide, les 3 octets ne correspondent # à aucune chaîne à rechercher. C'est la même situation que # si le 3ème octet ne correspond à aucune case du 3ème tableau. } $i_2++ } # Si il ne correspond pas, le premier octet est traité, # c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. # De plus $i_byte_check est réinitialisée donc on retourne # à la première boucle de vérification pour vider le buffer. if ($b_exit_while_1 -eq $flase -or $array_match_found_1.GetUpperBound(0) -lt 0) { $i_byte_check = 0 $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) # Si le buffer contient plusieurs cases, # on les décale vers l'arrière et on le raccourcit d'une case. if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } break } 3 { $b_exit_while_1 = $flase $i_3 = 0 while ($i_3 -le $array_bytes_to_find_4_2D_ubound -and $b_exit_while_1 -eq $flase) { if ($array_byte_buffer_1[$i_byte_check] -eq $array_bytes_to_find_4_2D[$i_3, 0]) { $b_exit_while_1 = $true $array_match_found_2 = @() $i_2_2D = 0 $b_exit_while_2 = $false while ($i_2_2D -le $array_match_found_1.GetUpperBound(0) -and $b_exit_while_2 -eq $false) { if ($array_match_found_1[$i_2_2D] -ne $null) { $i_3_2D = 1 $b_exit_while_3 = $false while ($i_3_2D -le $array_bytes_to_find_4_2D.GetUpperBound(1) -and $b_exit_while_3 -eq $false) { if ($array_bytes_to_find_4_2D[$i_3, $i_3_2D] -ne $null) { if ($array_match_found_1[$i_2_2D] -eq $array_bytes_to_find_4_2D[$i_3, $i_3_2D]) { $array_match_found_2 += $array_match_found_1[$i_2_2D] } $i_3_2D++ } else { $b_exit_while_3 = $true } } $i_2_2D++ } else { $b_exit_while_2 = $true } } $array_match_found_1 = $array_match_found_2 if ($array_match_found_1.GetUpperBound(0) -ge 0) { Write-Host -NoNewline "*" # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_bytes_to_find_4_2D[$i_3, 0])" # Write-Host "Les octets du buffer ""$($array_byte_buffer_1 -join " ")"" doivent commencer la/les chaîne(s) ""$($array_match_found_1 -join " ")""" $i_byte_check++ # $i_byte_check = 4 } } $i_3++ } if ($b_exit_while_1 -eq $flase -or $array_match_found_1.GetUpperBound(0) -lt 0) { $i_byte_check = 0 $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } break } 4 { $b_exit_while_1 = $flase $i_4 = 0 while ($i_4 -le $array_bytes_to_find_5_2D_ubound -and $b_exit_while_1 -eq $flase) { if ($array_byte_buffer_1[$i_byte_check] -eq $array_bytes_to_find_5_2D[$i_4, 0]) { $b_exit_while_1 = $true $array_match_found_2 = @() $i_3_2D = 0 $b_exit_while_2 = $false while ($i_3_2D -le $array_match_found_1.GetUpperBound(0) -and $b_exit_while_2 -eq $false) { if ($array_match_found_1[$i_3_2D] -ne $null) { $i_4_2D = 1 $b_exit_while_3 = $false while ($i_4_2D -le $array_bytes_to_find_5_2D.GetUpperBound(1) -and $b_exit_while_3 -eq $false) { if ($array_bytes_to_find_5_2D[$i_4, $i_4_2D] -ne $null) { if ($array_match_found_1[$i_3_2D] -eq $array_bytes_to_find_5_2D[$i_4, $i_4_2D]) { $array_match_found_2 += $array_match_found_1[$i_3_2D] } $i_4_2D++ } else { $b_exit_while_3 = $true } } $i_3_2D++ } else { $b_exit_while_2 = $true } } $array_match_found_1 = $array_match_found_2 if ($array_match_found_1.GetUpperBound(0) -ge 0) { Write-Host -NoNewline "*" # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_bytes_to_find_5_2D[$i_4, 0])" # Write-Host "Les octets du buffer ""$($array_byte_buffer_1 -join " ")"" doivent commencer la/les chaîne(s) ""$($array_match_found_1 -join " ")""" $i_byte_check++ # $i_byte_check = 5 } } $i_4++ } if ($b_exit_while_1 -eq $flase -or $array_match_found_1.GetUpperBound(0) -lt 0) { $i_byte_check = 0 $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } break } default { # On prend le tableau $array_match_found_1, il contient le # (ou les) numéro de case du tableau $array_hex_strings_to_find # qui lui-même contient la chaîne complète des octets à analyser # dont les 5 premiers octets correspondent. # Remarque : il se peut que plusieurs chaînes aient leurs 5 premiers # octets en commun. Voire que seul le dernier octet soit différent. # Donc on analyse chaque case du tableau $array_match_found_1. $b_exit_while_1 = $flase $i_5 = 0 # (Inutile car i_5 reste à 0) while ($i_5 -le $array_match_found_1.GetUpperBound(0) -and $b_exit_while_1 -eq $flase) { # On analyse la chaîne contenue dans $array_hex_strings_to_find. # Si la chaîne continue à correspondre, on teste l'octet suivant. if ($array_byte_buffer_1[$i_byte_check].ToString("X2") -eq $array_hex_strings_to_find[$array_match_found_1[$i_5]].Substring(2 * $i_byte_check, 2)) { Write-Host -NoNewline "*" # Write-Host "Étape $i_byte_check - Correspondance trouvée : $($array_byte_buffer_1[$i_byte_check]) = $($array_hex_strings_to_find[$array_match_found_1[$i_5]].Substring(2 * $i_byte_check, 2))" $b_exit_while_1 = $true $i_byte_check++ } # Si la chaîne ne correspond plus, alors on retire son numéro du tableau $array_match_found_1. # Et si le tableau est vide, alors aucune chaîne ne correspondait, # donc le premier octet est traité et $i_byte_check est réinitialisée. else { if ($array_match_found_1.GetUpperBound(0) -ge 1) { $array_match_found_2 = @() $array_match_found_2 = $array_match_found_1[1..($($array_match_found_1.GetUpperBound(0) + 1) - 1)] $array_match_found_1 = $array_match_found_2 } else { $array_match_found_1 = @() $i_byte_check = 0 $file_output.WriteByte($array_byte_buffer_1[$i_byte_check]) if ($array_byte_buffer_1.GetUpperBound(0) -ge 1) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[1..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 } else { $array_byte_buffer_1 = @() } } } if ($i_byte_check -gt 0) { # Si la correspondance va jusqu'au bout de la chaîne, alors la chaîne a été détectée. if ($i_byte_check -eq $array_hex_strings_to_find[$array_match_found_1[$i_5]].Length / 2) { # Dans ce cas on écrit la nouvelle chaîne et on vide le buffer. for ($i = 0; $i -le $array_hex_strings_to_replace[$array_match_found_1[$i_5]].Length - 1; $i += 2) { $file_output.WriteByte([byte]::Parse($array_hex_strings_to_replace[$array_match_found_1[$i_5]].Substring($i, 2), [System.Globalization.NumberStyles]::HexNumber)) } # Write-Host `r`n"Contenu de la chaîne n°$($array_match_found_1[$i_5] + 1) ($($array_hex_strings_to_find[$array_match_found_1[$i_5]].Length / 2) cases) : $($array_hex_strings_to_find[$array_match_found_1[$i_5]])`r`nContenu du buffer ($($array_byte_buffer_1.GetUpperBound(0) + 1) cases) : $($array_byte_buffer_1 -join " ")" # On vide le buffer de la chaîne à rechercher. if ($array_byte_buffer_1.GetUpperBound(0) -ge $array_hex_strings_to_find[$array_match_found_1[$i_5]].Length / 2) { $array_byte_buffer_2 = @() $array_byte_buffer_2 = $array_byte_buffer_1[($array_hex_strings_to_find[$array_match_found_1[$i_5]].Length / 2)..($($array_byte_buffer_1.GetUpperBound(0) + 1) - 1)] $array_byte_buffer_1 = $array_byte_buffer_2 # Write-Host "Contenu restant du buffer = : $($array_byte_buffer_1 -join " ")" } else { $array_byte_buffer_1 = @() } $i_byte_check = 0 $i_replacement_count++ Write-Host "`r`nFichier :`r`n$file_fullname`r`nSéquence n°$($array_match_found_1[$i_5] + 1) trouvée :`r`n$($array_hex_strings_to_find[$array_match_found_1[$i_5]])`r`nRemplacée par :`r`n$($array_hex_strings_to_replace[$array_match_found_1[$i_5]])`r`n" Write-Host -NoNewline "`r`nAnalyse en cours... " } } } } } } $file_input.Close() $file_output.Close() $file_input.Dispose() $file_output.Dispose() return $i_replacement_count } function i_my_rename_file([string]$file_fullname, [string]$file_fullname_new) { if ((Test-Path $file_fullname) -eq $false) { Write-Host "Erreur, le fichier :`r`n$file_fullname`r`nn'existe pas, impossible de le renommer en :`r`n$file_fullname_new" Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } Rename-Item -Path $file_fullname -NewName $file_fullname_new -ErrorAction Stop Write-Host "Le fichier :`r`n$file_fullname`r`na été renommé en :`r`n$file_fullname_new`r`n" if ((Test-Path $file_fullname_new) -eq $false) { Write-Host "Erreur, le fichier :`r`n$file_fullname`r`nn'a pas pu être renommé." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } return 0 } function i_my_fix_corrupted_file([string[]]$corrupted_file_error_ori, [string[]]$corrupted_file_error_fix, [string]$corrupted_file) { $i_installation_type = 0 if ($program_folder -ne "") { if ((Test-Path "$program_folder\$corrupted_file") -eq $false) { Write-Host "Erreur, fichier non détecté :`r`n$program_folder\$corrupted_file" Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } $i_installation_type = 1 Write-Host "Fichier détecté :`r`n$program_folder\$corrupted_file`r`n" } if ((Test-Path "$program_folder_portable_32\$corrupted_file") -eq $true) { $i_installation_type = 2 Write-Host "Fichier détecté :`r`n$program_folder_portable_32\$corrupted_file`r`n" } if ((Test-Path "$program_folder_portable_64\$corrupted_file") -eq $true) { $i_installation_type += 3 Write-Host "Fichier détecté :`r`n$program_folder_portable_64\$corrupted_file`r`n" } if ((Test-Path "$program_folder_installed_32\$corrupted_file") -eq $true) { $i_installation_type = 6 Write-Host "Fichier détecté :`r`n$program_folder_portable_32\$corrupted_file`r`n" } if ((Test-Path "$program_folder_installed_64\$corrupted_file") -eq $true) { $i_installation_type = 7 Write-Host "Fichier détecté :`r`n$program_folder_portable_64\$corrupted_file`r`n" } if ($i_installation_type -eq 0) { Write-Host "Erreur, aucun fichier détecté." Write-Host "`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 } if ($i_installation_type -eq 1) { if ((Test-Path -Path "$program_folder\$corrupted_file.bak" -PathType Leaf) -eq $true) { Write-Host "Attention, le fichier de sauvegarde :`r`n$program_folder\$corrupted_file.bak" Write-Host "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," Write-Host "appuyez sur ""o"" pour supprimer le fichier "".bak"" et continuer,`r`nsinon appuyez sur une autre touche pour quitter." if ($Host.UI.RawUI.KeyAvailable -eq $true) { Write-Host "`r`nAppuyez sur une touche pour continuer..." while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } $user_response = Read-Host "`r`nVoulez-vous continuer ? (o = oui)" $user_response = $user_response.ToLower() if ($user_response -ne "o") { exit 0 } Remove-Item -Path "$program_folder\$corrupted_file.bak" -Force Write-Host "Le fichier :`r`n$program_folder\$corrupted_file.bak`r`na été supprimé." } $number_of_replacements = i_my_replace_array_hex_strings_in_file $corrupted_file_error_ori $corrupted_file_error_fix ("$program_folder\$corrupted_file") Write-Host "`r`n`r`n$number_of_replacements remplacement(s) effectué(s) sur le fichier :`r`n$program_folder\$corrupted_file`r`n" $i_return = i_my_rename_file "$program_folder\$corrupted_file" "$program_folder\$corrupted_file.bak" $i_return = i_my_rename_file "$program_folder\$corrupted_file.temporary" "$program_folder\$corrupted_file" } if ($i_installation_type -eq 2 -or $i_installation_type -eq 5) { if ((Test-Path -Path "$program_folder_portable_32\$corrupted_file.bak" -PathType Leaf) -eq $true) { Write-Host "Attention, le fichier de sauvegarde :`r`n$program_folder_portable_32\$corrupted_file.bak" Write-Host "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," Write-Host "appuyez sur ""o"" pour supprimer le fichier "".bak"" et continuer,`r`nsinon appuyez sur une autre touche pour quitter." if ($Host.UI.RawUI.KeyAvailable -eq $true) { Write-Host "`r`nAppuyez sur une touche pour continuer..." while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } $user_response = Read-Host "`r`nVoulez-vous continuer ? (o = oui)" $user_response = $user_response.ToLower() if ($user_response -ne "o") { exit 0 } Remove-Item -Path "$program_folder_portable_32\$corrupted_file.bak" -Force Write-Host "Le fichier :`r`n$program_folder_portable_32\$corrupted_file.bak`r`na été supprimé." } $number_of_replacements = i_my_replace_array_hex_strings_in_file $corrupted_file_error_ori $corrupted_file_error_fix ("$program_folder_portable_32\$corrupted_file") Write-Host "`r`n`r`n$number_of_replacements remplacement(s) effectué(s) sur le fichier :`r`n$program_folder_portable_32\$corrupted_file`r`n" $i_return = i_my_rename_file "$program_folder_portable_32\$corrupted_file" "$program_folder_portable_32\$corrupted_file.bak" $i_return = i_my_rename_file "$program_folder_portable_32\$corrupted_file.temporary" "$program_folder_portable_32\$corrupted_file" } if ($i_installation_type -eq 3 -or $i_installation_type -eq 5) { if ((Test-Path -Path "$program_folder_portable_64\$corrupted_file.bak" -PathType Leaf) -eq $true) { Write-Host "Attention, le fichier de sauvegarde :`r`n$program_folder_portable_64\$corrupted_file.bak" Write-Host "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," Write-Host "appuyez sur ""o"" pour supprimer le fichier "".bak"" et continuer,`r`nsinon appuyez sur une autre touche pour quitter." if ($Host.UI.RawUI.KeyAvailable -eq $true) { Write-Host "`r`nAppuyez sur une touche pour continuer..." while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } $user_response = Read-Host "`r`nVoulez-vous continuer ? (o = oui)" $user_response = $user_response.ToLower() if ($user_response -ne "o") { exit 0 } Remove-Item -Path "$program_folder_portable_64\$corrupted_file.bak" -Force Write-Host "Le fichier :`r`n$program_folder_portable_64\$corrupted_file.bak`r`na été supprimé." } $number_of_replacements = i_my_replace_array_hex_strings_in_file $corrupted_file_error_ori $corrupted_file_error_fix ("$program_folder_portable_64\$corrupted_file") Write-Host "`r`n`r`n$number_of_replacements remplacement(s) effectué(s) sur le fichier :`r`n$program_folder_portable_64\$corrupted_file`r`n" $i_return = i_my_rename_file "$program_folder_portable_64\$corrupted_file" "$program_folder_portable_64\$corrupted_file.bak" $i_return = i_my_rename_file "$program_folder_portable_64\$corrupted_file.temporary" "$program_folder_portable_64\$corrupted_file" } if ($i_installation_type -eq 6) { if ((Test-Path -Path "$program_folder_installed_32\$corrupted_file.bak" -PathType Leaf) -eq $true) { Write-Host "Attention, le fichier de sauvegarde :`r`n$program_folder_installed_32\$corrupted_file.bak" Write-Host "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," Write-Host "appuyez sur ""o"" pour supprimer le fichier "".bak"" et continuer,`r`nsinon appuyez sur une autre touche pour quitter." if ($Host.UI.RawUI.KeyAvailable -eq $true) { Write-Host "`r`nAppuyez sur une touche pour continuer..." while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } $user_response = Read-Host "`r`nVoulez-vous continuer ? (o = oui)" $user_response = $user_response.ToLower() if ($user_response -ne "o") { exit 0 } Remove-Item -Path "$program_folder_installed_32\$corrupted_file.bak" -Force Write-Host "Le fichier :`r`n$program_folder_installed_32\$corrupted_file.bak`r`na été supprimé." } $number_of_replacements = i_my_replace_array_hex_strings_in_file $corrupted_file_error_ori $corrupted_file_error_fix ("$program_folder_installed_32\$corrupted_file") Write-Host "`r`n`r`n$number_of_replacements remplacement(s) effectué(s) sur le fichier :`r`n$program_folder_installed_32\$corrupted_file`r`n" $i_return = i_my_rename_file "$program_folder_installed_32\$corrupted_file" "$program_folder_installed_32\$corrupted_file.bak" $i_return = i_my_rename_file "$program_folder_installed_32\$corrupted_file.temporary" "$program_folder_installed_32\$corrupted_file" } if ($i_installation_type -eq 7) { if ((Test-Path -Path "$program_folder_installed_64\$corrupted_file.bak" -PathType Leaf) -eq $true) { Write-Host "Attention, le fichier de sauvegarde :`r`n$program_folder_installed_64\$corrupted_file.bak" Write-Host "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," Write-Host "appuyez sur ""o"" pour supprimer le fichier "".bak"" et continuer,`r`nsinon appuyez sur une autre touche pour quitter." if ($Host.UI.RawUI.KeyAvailable -eq $true) { Write-Host "`r`nAppuyez sur une touche pour continuer..." while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } $user_response = Read-Host "`r`nVoulez-vous continuer ? (o = oui)" $user_response = $user_response.ToLower() if ($user_response -ne "o") { exit 0 } Remove-Item -Path "$program_folder_installed_64\$corrupted_file.bak" -Force Write-Host "Le fichier :`r`n$program_folder_installed_64\$corrupted_file.bak`r`na été supprimé." } $number_of_replacements = i_my_replace_array_hex_strings_in_file $corrupted_file_error_ori $corrupted_file_error_fix ("$program_folder_installed_64\$corrupted_file") Write-Host "`r`n`r`n$number_of_replacements remplacement(s) effectué(s) sur le fichier :`r`n$program_folder_installed_64\$corrupted_file`r`n" $i_return = i_my_rename_file "$program_folder_installed_64\$corrupted_file" "$program_folder_installed_64\$corrupted_file.bak" $i_return = i_my_rename_file "$program_folder_installed_64\$corrupted_file.temporary" "$program_folder_installed_64\$corrupted_file" } return $number_of_replacements } # _____________________________________________________________________________ # Partie à modifier pour ajouter des fichiers à corriger : # Lancement du script : $number_of_replacements = i_my_fix_corrupted_file $corrupted_file_1_error_ori $corrupted_file_1_error_fix ("$corrupted_file_1") $number_of_replacements = i_my_fix_corrupted_file $corrupted_file_2_error_ori $corrupted_file_2_error_fix ("$corrupted_file_2") # _____________________________________________________________________________ # Partie à ne pas modifier : $pause_message = "L'exécution de ce programme est terminée." Write-Host "$pause_message`r`n`r`nAppuyez sur une touche pour continuer..." if ($Host.UI.RawUI.KeyAvailable -eq $true) { while ($Host.UI.RawUI.KeyAvailable -eq $true) { $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null } } else { $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit 0 Firefox en VBScript ' Character encoding = UTF-16 LE (Byte Order Mark = FF FE) ' End-of-line = Windows (CR LF) ' Composants requis : set object_shell = WScript.CreateObject("WScript.Shell") set object_file_system = WScript.CreateObject("Scripting.FileSystemObject") current_folder = object_file_system.GetParentFolderName(WScript.ScriptFullName) ' _____________________________________________________________________________ ' Partie à modifier pour ajouter des fichiers et erreurs à corriger : ' Emplacement personnalisé du dossier contenant le fichier "firefox.exe". ' Vous pouvez le laisser vide. Exemple : ' program_folder = current_folder & "\Mozilla Firefox" program_folder = "" ' Emplacements connus : program_folder_portable_32 = current_folder & "\App\Firefox" program_folder_portable_64 = current_folder & "\App\Firefox64" program_folder_installed_32 = object_shell.ExpandEnvironmentStrings("%ProgramFiles(x86)%") & "\Mozilla Firefox" program_folder_installed_64 = object_shell.ExpandEnvironmentStrings("%ProgramFiles%") & "\Mozilla Firefox" ' Fichiers à réparer : corrupted_file_1 = "omni.ja" corrupted_file_2 = "browser\omni.ja" ' Réparations à faire : dim corrupted_file_1_error_ori() redim corrupted_file_1_error_ori(-1) dim corrupted_file_1_error_fix() redim corrupted_file_1_error_fix(-1) ' utilisateur·trice => utilisateur redim preserve corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori) + 1) corrupted_file_1_error_ori(ubound(corrupted_file_1_error_ori)) = "C2B774726963650A" ' ·trice redim preserve corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix) + 1) corrupted_file_1_error_fix(ubound(corrupted_file_1_error_fix)) = "0A0A0A0A0A0A0A0A" ' dim corrupted_file_2_error_ori() redim corrupted_file_2_error_ori(-1) dim corrupted_file_2_error_fix() redim corrupted_file_2_error_fix(-1) ' administrateur·trice a désactivé la synchronisation. => administrateur a désactivé la synchronisation. redim preserve corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori) + 1) corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori)) = "C2B7747269636520612064C3A9736163746976C3A9206C612073796E6368726F6E69736174696F6E2E0A" ' ·trice a désactivé la synchronisation. redim preserve corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix) + 1) corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix)) = "20612064C3A9736163746976C3A9206C612073796E6368726F6E69736174696F6E2E0A0A0A0A0A0A0A0A" ' a désactivé la synchronisation. ' connecté·e. => connecté. redim preserve corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori) + 1) corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori)) = "C3A9C2B7652E0A" ' é·e. redim preserve corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix) + 1) corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix)) = "C3A92E0A0A0A0A" ' é. ' connecté·e avec succès => connecté avec succès redim preserve corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori) + 1) corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori)) = "C2B76520617665632073756363C3A8730A" ' ·e avec succès redim preserve corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix) + 1) corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix)) = "20617665632073756363C3A8730A0A0A0A" ' avec succès ' suivi·e => suivi redim preserve corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori) + 1) corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori)) = "7669C2B7650A" ' vi·e redim preserve corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix) + 1) corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix)) = "76690A0A0A0A" ' vi ' Prêt·e à scanner</strong> et maintenez votre appareil au-dessus de ce code => Prêt à scanner</strong> et maintenez votre appareil au-dessus de ce code redim preserve corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori) + 1) corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori)) = "C2B76520C3A0207363616E6E65723C2F7374726F6E673E206574206D61696E74656E657A20766F74726520617070617265696C2061752D64657373757320646520636520636F64650A" ' ·e à scanner</strong> et maintenez votre appareil au-dessus de ce code redim preserve corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix) + 1) corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix)) = "20C3A0207363616E6E65723C2F7374726F6E673E206574206D61696E74656E657A20766F74726520617070617265696C2061752D64657373757320646520636520636F64650A0A0A0A" ' à scanner</strong> et maintenez votre appareil au-dessus de ce code ' pisté·e => pisté redim preserve corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori) + 1) corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori)) = "C3A9C2B7650A" ' é·e redim preserve corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix) + 1) corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix)) = "C3A90A0A0A0A" ' é ' véritables client·e·s qui ont laissé des avis sincères et objectifs. redim preserve corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori) + 1) corrupted_file_2_error_ori(ubound(corrupted_file_2_error_ori)) = "C2B765C2B77320717569206F6E74206C61697373C3A92064657320617669732073696E63C3A8726573206574206F626A6563746966732E0A" ' ·e·s qui ont laissé des avis sincères et objectifs. redim preserve corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix) + 1) corrupted_file_2_error_fix(ubound(corrupted_file_2_error_fix)) = "7320717569206F6E74206C61697373C3A92064657320617669732073696E63C3A8726573206574206F626A6563746966732E0A0A0A0A0A0A" ' s qui ont laissé des avis sincères et objectifs. ' _____________________________________________________________________________ ' Partie à ne pas modifier : function i_my_replace_array_hex_strings_in_file(byval array_hex_strings_to_find, byval array_hex_strings_to_replace, byval file_fullname) if ubound(array_hex_strings_to_find) <> ubound(array_hex_strings_to_replace) then MsgBox "Erreur :" & vbCrLf & "Le nombre de cases dans le tableau des chaînes hexadécimales à détecter (" & ubound(array_hex_strings_to_find) + 1 & ")" & vbCrLf & "et dans le tableau des chaînes hexadécimales à remplacer (" & ubound(array_hex_strings_to_replace) + 1 & ")" & vbCrLf & "n'est pas identique.", 48, "Erreur" ' 0 = vbOKOnly vbDefaultButton1 vbApplicationModal 48 = vbExclamation WScript.Quit(0) end if for i = 0 to ubound(array_hex_strings_to_find) step 1 if len(array_hex_strings_to_find(i)) <> len(array_hex_strings_to_replace(i)) then MsgBox "Erreur :" & vbCrLf & "La variable " & array_hex_strings_to_find(i) & " et" & vbCrLf & "la variable " & array_hex_strings_to_replace(i) & vbCrLf _ & "n'ont pas le même nombre de caractères (" & len(array_hex_strings_to_find(i)) & " contre " & len(array_hex_strings_to_replace(i)) & ").", 48, "Erreur" WScript.Quit(0) end if if len(array_hex_strings_to_find(i)) MOD 2 <> 0 then MsgBox "Erreur, les variables :" & vbCrLf & array_hex_strings_to_find(i) & " et" & vbCrLf & array_hex_strings_to_replace(i) & vbCrLf & "ont un nombre impair de caractères.", 48, "Erreur" WScript.Quit(0) end if if len(array_hex_strings_to_find(i)) < 12 then MsgBox "Erreur, les variables :" & vbCrLf & array_hex_strings_to_find(i) & " et" & vbCrLf & array_hex_strings_to_replace(i) & vbCrLf _ & "doivent avoir au moins 12 caractères hexadécimaux pour représenter" & vbCrLf _ & "au moins 6 octets. Or ici, elles n'en contiennent que " & len(array_hex_strings_to_find(i)) & ".", 48, "Erreur" WScript.Quit(0) end if next set object_file = object_file_system.CreateTextFile(file_fullname & ".temporary", TRUE, FALSE) ' (TRUE = Écraser si existe déjà) (FALSE = Utiliser ASCII au lieu d'Unicode UTF16LE donc pas de Byte Order Mark FFFE) object_file.Close if object_file_system.FileExists(file_fullname & ".temporary") = FALSE then MsgBox "Erreur, le fichier :" & vbCrLf & file_fullname & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur.", 48, "Erreur" WScript.Quit(0) end if ' Pour aller plus vite, on crée 5 tableaux en 2 dimensions. ' Nous sommes obligés de créer chaque dimension indépendamment car ' il est impossible de redimensionner dynamiquement les 2 dimensions. ' Concernant la 1ère dimension : ' Le 1er tableau contiendra les premiers octets de toutes les chaînes ' à rechercher, convertis en décimal et en éliminant les doublons. ' Le 2ème tableau contiendra les deuxièmes octets, etc. ' Le 3ème tableau contiendra les troisièmes octets, etc. dim array_bytes_to_find_1() redim array_bytes_to_find_1(-1) dim array_bytes_to_find_2() redim array_bytes_to_find_2(-1) dim array_bytes_to_find_3() redim array_bytes_to_find_3(-1) dim array_bytes_to_find_4() redim array_bytes_to_find_4(-1) dim array_bytes_to_find_5() redim array_bytes_to_find_5(-1) for i_1 = 0 to ubound(array_hex_strings_to_find) step 1 b_already_exists = FALSE for i_2 = 0 to ubound(array_bytes_to_find_1) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_1), 1, 2)) = array_bytes_to_find_1(i_2) then b_already_exists = TRUE end if next if b_already_exists = FALSE then redim preserve array_bytes_to_find_1(ubound(array_bytes_to_find_1) + 1) array_bytes_to_find_1(ubound(array_bytes_to_find_1)) = cint("&H" & mid(array_hex_strings_to_find(i_1), 1, 2)) end if b_already_exists = FALSE for i_2 = 0 to ubound(array_bytes_to_find_2) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_1), 3, 2)) = array_bytes_to_find_2(i_2) then b_already_exists = TRUE end if next if b_already_exists = FALSE then redim preserve array_bytes_to_find_2(ubound(array_bytes_to_find_2) + 1) array_bytes_to_find_2(ubound(array_bytes_to_find_2)) = cint("&H" & mid(array_hex_strings_to_find(i_1), 3, 2)) end if b_already_exists = FALSE for i_2 = 0 to ubound(array_bytes_to_find_3) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_1), 5, 2)) = array_bytes_to_find_3(i_2) then b_already_exists = TRUE end if next if b_already_exists = FALSE then redim preserve array_bytes_to_find_3(ubound(array_bytes_to_find_3) + 1) array_bytes_to_find_3(ubound(array_bytes_to_find_3)) = cint("&H" & mid(array_hex_strings_to_find(i_1), 5, 2)) end if b_already_exists = FALSE for i_2 = 0 to ubound(array_bytes_to_find_4) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_1), 7, 2)) = array_bytes_to_find_4(i_2) then b_already_exists = TRUE end if next if b_already_exists = FALSE then redim preserve array_bytes_to_find_4(ubound(array_bytes_to_find_4) + 1) array_bytes_to_find_4(ubound(array_bytes_to_find_4)) = cint("&H" & mid(array_hex_strings_to_find(i_1), 7, 2)) end if b_already_exists = FALSE for i_2 = 0 to ubound(array_bytes_to_find_5) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_1), 9, 2)) = array_bytes_to_find_5(i_2) then b_already_exists = TRUE end if next if b_already_exists = FALSE then redim preserve array_bytes_to_find_5(ubound(array_bytes_to_find_5) + 1) array_bytes_to_find_5(ubound(array_bytes_to_find_5)) = cint("&H" & mid(array_hex_strings_to_find(i_1), 9, 2)) end if next ' Concernant la 2ème dimension : ' Pour chaque tableau, elle contiendra les numéros des chaînes ' auxquelles les octets correspondent (en commençant par 0). ' Imaginons que la 1ère case du 1er tableau contient l'octet C2 = 194 ' et plusieurs chaînes commencent par C2 (doublons), par exemple les ' chaînes 1 2 4 5 6, alors les chiffres 0 1 3 4 5 seront inscrits ' dans la 2ème dimension de la 1ère case du 1er tableau. dim array_bytes_to_find_1_2D() redim array_bytes_to_find_1_2D(ubound(array_bytes_to_find_1), 0) dim array_bytes_to_find_2_2D() redim array_bytes_to_find_2_2D(ubound(array_bytes_to_find_2), 0) dim array_bytes_to_find_3_2D() redim array_bytes_to_find_3_2D(ubound(array_bytes_to_find_3), 0) dim array_bytes_to_find_4_2D() redim array_bytes_to_find_4_2D(ubound(array_bytes_to_find_4), 0) dim array_bytes_to_find_5_2D() redim array_bytes_to_find_5_2D(ubound(array_bytes_to_find_5), 0) for i_1 = 0 to ubound(array_bytes_to_find_1_2D, 1) step 1 array_bytes_to_find_1_2D(i_1, 0) = array_bytes_to_find_1(i_1) i_2 = 1 for i_3 = 0 to ubound(array_hex_strings_to_find) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_3), 1, 2)) = array_bytes_to_find_1_2D(i_1, 0) then if ubound(array_bytes_to_find_1_2D, 2) < i_2 then redim preserve array_bytes_to_find_1_2D(ubound(array_bytes_to_find_1_2D, 1), ubound(array_bytes_to_find_1_2D, 2) + 1) end if array_bytes_to_find_1_2D(i_1, i_2) = i_3 i_2 = i_2 + 1 end if next next for i_1 = 0 to ubound(array_bytes_to_find_2_2D, 1) step 1 array_bytes_to_find_2_2D(i_1, 0) = array_bytes_to_find_2(i_1) i_2 = 1 for i_3 = 0 to ubound(array_hex_strings_to_find) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_3), 3, 2)) = array_bytes_to_find_2_2D(i_1, 0) then if ubound(array_bytes_to_find_2_2D, 2) < i_2 then redim preserve array_bytes_to_find_2_2D(ubound(array_bytes_to_find_2_2D, 1), ubound(array_bytes_to_find_2_2D, 2) + 1) end if array_bytes_to_find_2_2D(i_1, i_2) = i_3 i_2 = i_2 + 1 end if next next for i_1 = 0 to ubound(array_bytes_to_find_3_2D, 1) step 1 array_bytes_to_find_3_2D(i_1, 0) = array_bytes_to_find_3(i_1) i_2 = 1 for i_3 = 0 to ubound(array_hex_strings_to_find) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_3), 5, 2)) = array_bytes_to_find_3_2D(i_1, 0) then if ubound(array_bytes_to_find_3_2D, 2) < i_2 then redim preserve array_bytes_to_find_3_2D(ubound(array_bytes_to_find_3_2D, 1), ubound(array_bytes_to_find_3_2D, 2) + 1) end if array_bytes_to_find_3_2D(i_1, i_2) = i_3 i_2 = i_2 + 1 end if next next for i_1 = 0 to ubound(array_bytes_to_find_4_2D, 1) step 1 array_bytes_to_find_4_2D(i_1, 0) = array_bytes_to_find_4(i_1) i_2 = 1 for i_3 = 0 to ubound(array_hex_strings_to_find) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_3), 7, 2)) = array_bytes_to_find_4_2D(i_1, 0) then if ubound(array_bytes_to_find_4_2D, 2) < i_2 then redim preserve array_bytes_to_find_4_2D(ubound(array_bytes_to_find_4_2D, 1), ubound(array_bytes_to_find_4_2D, 2) + 1) end if array_bytes_to_find_4_2D(i_1, i_2) = i_3 i_2 = i_2 + 1 end if next next for i_1 = 0 to ubound(array_bytes_to_find_5_2D, 1) step 1 array_bytes_to_find_5_2D(i_1, 0) = array_bytes_to_find_5(i_1) i_2 = 1 for i_3 = 0 to ubound(array_hex_strings_to_find) step 1 if cint("&H" & mid(array_hex_strings_to_find(i_3), 9, 2)) = array_bytes_to_find_5_2D(i_1, 0) then if ubound(array_bytes_to_find_5_2D, 2) < i_2 then redim preserve array_bytes_to_find_5_2D(ubound(array_bytes_to_find_5_2D, 1), ubound(array_bytes_to_find_5_2D, 2) + 1) end if array_bytes_to_find_5_2D(i_1, i_2) = i_3 i_2 = i_2 + 1 end if next next WScript_Echo_variable = "1ers octets à rechercher => Dans les chaînes : " & vbCrLf for i_1 = 0 to ubound(array_bytes_to_find_1_2D, 1) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_1_2D(i_1, 0) & " => " for i_2 = 1 to ubound(array_bytes_to_find_1_2D, 2) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_1_2D(i_1, i_2) if i_2 + 1 <= ubound(array_bytes_to_find_1_2D, 2) then if array_bytes_to_find_1_2D(i_1, i_2 + 1) <> "" then WScript_Echo_variable = WScript_Echo_variable & " " end if end if next WScript_Echo_variable = WScript_Echo_variable & vbCrLf Next ' WScript.Echo WScript_Echo_variable WScript_Echo_variable = "2èmes octets à rechercher => Dans les chaînes : " & vbCrLf for i_1 = 0 to ubound(array_bytes_to_find_2_2D, 1) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_2_2D(i_1, 0) & " => " for i_2 = 1 to ubound(array_bytes_to_find_2_2D, 2) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_2_2D(i_1, i_2) if i_2 + 1 <= ubound(array_bytes_to_find_2_2D, 2) then if array_bytes_to_find_2_2D(i_1, i_2 + 1) <> "" then WScript_Echo_variable = WScript_Echo_variable & " " end if end if next WScript_Echo_variable = WScript_Echo_variable & vbCrLf Next ' WScript.Echo WScript_Echo_variable WScript_Echo_variable = "3èmes octets à rechercher => Dans les chaînes : " & vbCrLf for i_1 = 0 to ubound(array_bytes_to_find_3_2D, 1) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_3_2D(i_1, 0) & " => " for i_2 = 1 to ubound(array_bytes_to_find_3_2D, 2) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_3_2D(i_1, i_2) if i_2 + 1 <= ubound(array_bytes_to_find_3_2D, 2) then if array_bytes_to_find_3_2D(i_1, i_2 + 1) <> "" then WScript_Echo_variable = WScript_Echo_variable & " " end if end if next WScript_Echo_variable = WScript_Echo_variable & vbCrLf Next ' WScript.Echo WScript_Echo_variable WScript_Echo_variable = "4èmes octets à rechercher => Dans les chaînes : " & vbCrLf for i_1 = 0 to ubound(array_bytes_to_find_4_2D, 1) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_4_2D(i_1, 0) & " => " for i_2 = 1 to ubound(array_bytes_to_find_4_2D, 2) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_4_2D(i_1, i_2) if i_2 + 1 <= ubound(array_bytes_to_find_4_2D, 2) then if array_bytes_to_find_4_2D(i_1, i_2 + 1) <> "" then WScript_Echo_variable = WScript_Echo_variable & " " end if end if next WScript_Echo_variable = WScript_Echo_variable & vbCrLf Next ' WScript.Echo WScript_Echo_variable WScript_Echo_variable = "5èmes octets à rechercher => Dans les chaînes : " & vbCrLf for i_1 = 0 to ubound(array_bytes_to_find_5_2D, 1) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_5_2D(i_1, 0) & " => " for i_2 = 1 to ubound(array_bytes_to_find_5_2D, 2) step 1 WScript_Echo_variable = WScript_Echo_variable & array_bytes_to_find_5_2D(i_1, i_2) if i_2 + 1 <= ubound(array_bytes_to_find_5_2D, 2) then if array_bytes_to_find_5_2D(i_1, i_2 + 1) <> "" then WScript_Echo_variable = WScript_Echo_variable & " " end if end if next WScript_Echo_variable = WScript_Echo_variable & vbCrLf Next ' WScript.Echo WScript_Echo_variable set file_input = object_file_system.OpenTextFile(file_fullname, 1) ' 1 = Ouverture du fichier en lecture set file_output = object_file_system.OpenTextFile(file_fullname & ".temporary", 2, TRUE, 0) ' 2 = Ouverture du fichier en écriture (TRUE = Fichier créé si n'existe pas) (0 = ASCII, -1 = Unicode, -2 = Par défaut) array_bytes_to_find_1_2D_ubound = ubound(array_bytes_to_find_1_2D, 1) array_bytes_to_find_2_2D_ubound = ubound(array_bytes_to_find_2_2D, 1) array_bytes_to_find_3_2D_ubound = ubound(array_bytes_to_find_3_2D, 1) array_bytes_to_find_4_2D_ubound = ubound(array_bytes_to_find_4_2D, 1) array_bytes_to_find_5_2D_ubound = ubound(array_bytes_to_find_5_2D, 1) dim array_byte_buffer_1() redim array_byte_buffer_1(-1) dim array_byte_buffer_2() redim array_byte_buffer_2(-1) dim array_match_found_1() redim array_match_found_1(-1) dim array_match_found_2() redim array_match_found_2(-1) byte_read = 0 i_byte_check = 0 i_replacement_count = 0 do until file_input.AtEndOfStream byte_read = asc(file_input.Read(1)) ' WScript.Echo "Caractère lu (hexadécimal " & string(2 - len(hex(byte_read)), "0") & ucase((hex(byte_read))) & " = décimal " & byte_read & ") : """ & chr(byte_read) & """" ' L'octet lu est stocké dans la dernière case d'un tableau (buffer). redim preserve array_byte_buffer_1(ubound(array_byte_buffer_1) + 1) array_byte_buffer_1(ubound(array_byte_buffer_1)) = byte_read ' WScript.Echo "Contenu du buffer : " & join(array_byte_buffer_1, " ") select case i_byte_check case 0 ' On considère que le buffer peut contenir plusieurs octets en attente d'être traités, ' c'est-à-dire écrits dans le fichier de sortie s'il n'existe aucune correspondance. ' Chaque 1er octet traité disparaît du buffer, dont la taille se réduit. ' Lorsque sa taille atteint 0 (ubound = -1), le buffer est vide, ' tous les octets ont été traités. b_exit_while_1 = FALSE while ubound(array_byte_buffer_1) >= 0 AND b_exit_while_1 = FALSE ' Première boucle de vérification. ' On compare le 1er octet (i_byte_check = 0) du buffer ' aux octets stockés dans les cases de la 1ère dimension du 1er tableau. i_0 = 0 while i_0 <= array_bytes_to_find_1_2D_ubound AND b_exit_while_1 = FALSE ' Si il correspond à une case, ' l'écriture du fichier de sortie est suspendue (i_byte_check ≠ 0) ' et l'octet reste stocké dans le buffer. if array_byte_buffer_1(i_byte_check) = array_bytes_to_find_1_2D(i_0, 0) then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & array_bytes_to_find_1_2D(i_0, 0) b_exit_while_1 = TRUE i_byte_check = i_byte_check + 1 ' i_byte_check = 1 i_0 = i_0 - 1 end if i_0 = i_0 + 1 wend ' Si il ne correspond pas, l'octet est traité, ' c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. if b_exit_while_1 = FALSE then file_output.Write(chr(array_byte_buffer_1(i_byte_check))) ' Si le buffer contient plusieurs cases, ' on les décale vers l'arrière et on le raccourcit d'une case. if ubound(array_byte_buffer_1) >= 1 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if wend ' break case 1 ' Deuxième boucle de vérification. ' On compare le 2ème octet (i_byte_check = 1) du buffer ' aux octets stockés dans les cases de la 1ère dimension du 2ème tableau. b_exit_while_1 = FALSE i_1 = 0 while i_1 <= array_bytes_to_find_2_2D_ubound AND b_exit_while_1 = FALSE ' Si il correspond à une case, ' on compare la 2ème dimension de la case du 1er tableau précédent ' à la 2ème dimension de cette case de ce 2ème tableau et ' on stocke les numéros communs dans un tableau : array_match_found_1. if array_byte_buffer_1(i_byte_check) = array_bytes_to_find_2_2D(i_1, 0) then b_exit_while_1 = TRUE redim array_match_found_1(-1) i_0_2D = 1 b_exit_while_2 = FALSE while i_0_2D <= ubound(array_bytes_to_find_1_2D, 2) AND b_exit_while_2 = FALSE if array_bytes_to_find_1_2D(i_0, i_0_2D) <> "" then i_1_2D = 1 b_exit_while_3 = FALSE while i_1_2D <= ubound(array_bytes_to_find_2_2D, 2) AND b_exit_while_3 = FALSE if array_bytes_to_find_2_2D(i_1, i_1_2D) <> "" then if array_bytes_to_find_1_2D(i_0, i_0_2D) = array_bytes_to_find_2_2D(i_1, i_1_2D) then redim preserve array_match_found_1(ubound(array_match_found_1) + 1) array_match_found_1(ubound(array_match_found_1)) = array_bytes_to_find_1_2D(i_0, i_0_2D) end if i_1_2D = i_1_2D + 1 else b_exit_while_3 = TRUE end if wend i_0_2D = i_0_2D + 1 else b_exit_while_2 = TRUE end if wend ' Si le tableau n'est pas vide, il indique le ou les numéros ' des chaînes qui commencent par ces 2 octets. Dans ce cas : ' l'écriture du fichier de sortie reste suspendue (i_byte_check ≠ 0) ' et les octets restent stockés dans le buffer. if ubound(array_match_found_1) >= 0 then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & array_bytes_to_find_2_2D(i_1, 0) ' WScript.Echo "Les octets du buffer """ & join(array_byte_buffer_1, " ") & """ doivent commencer la/les chaîne(s) """ & join(array_match_found_1, " ") & """" i_byte_check = i_byte_check + 1 ' i_byte_check = 2 end if ' Si le tableau est vide, les 2 octets ne correspondent ' à aucune chaîne à rechercher. C'est la même situation que ' si le 2ème octet ne correspond à aucune case du 2ème tableau. end if i_1 = i_1 + 1 wend ' Si il ne correspond pas, le premier octet est traité, ' c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. ' De plus i_byte_check est réinitialisée donc on retourne ' à la première boucle de vérification pour vider le buffer. if b_exit_while_1 = FALSE OR ubound(array_match_found_1) < 0 then i_byte_check = 0 file_output.Write(chr(array_byte_buffer_1(i_byte_check))) ' Si le buffer contient plusieurs cases, ' on les décale vers l'arrière et on le raccourcit d'une case. if ubound(array_byte_buffer_1) >= 1 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if ' break case 2 ' Troisième boucle de vérification. ' On compare le 3ème octet (i_byte_check = 2) du buffer ' aux octets stockés dans les cases de la 1ère dimension du 3ème tableau. b_exit_while_1 = FALSE i_2 = 0 while i_2 <= array_bytes_to_find_3_2D_ubound AND b_exit_while_1 = FALSE ' Si il correspond à une case, ' on compare le tableau précédent array_match_found_1 ' à la 2ème dimension de cette case de ce 3ème tableau et ' on stocke les numéros communs dans array_match_found_1 ' par l'intermédiaire d'un tableau temporaire : array_match_found_2. if array_byte_buffer_1(i_byte_check) = array_bytes_to_find_3_2D(i_2, 0) then b_exit_while_1 = TRUE redim array_match_found_2(-1) i_1_2D = 0 b_exit_while_2 = FALSE while i_1_2D <= ubound(array_match_found_1) AND b_exit_while_2 = FALSE if array_match_found_1(i_1_2D) <> "" then i_2_2D = 1 b_exit_while_3 = FALSE while i_2_2D <= ubound(array_bytes_to_find_3_2D, 2) AND b_exit_while_3 = FALSE if array_bytes_to_find_3_2D(i_2, i_2_2D) <> "" then if array_match_found_1(i_1_2D) = array_bytes_to_find_3_2D(i_2, i_2_2D) then redim preserve array_match_found_2(ubound(array_match_found_2) + 1) array_match_found_2(ubound(array_match_found_2)) = array_match_found_1(i_1_2D) end if i_2_2D = i_2_2D + 1 else b_exit_while_3 = TRUE end if wend i_1_2D = i_1_2D + 1 else b_exit_while_2 = TRUE end if wend redim array_match_found_1(ubound(array_match_found_2)) for i = 0 to ubound(array_match_found_2) array_match_found_1(i) = array_match_found_2(i) next ' Si le tableau n'est pas vide, il indique le ou les numéros ' des chaînes qui commencent par ces 3 octets. Dans ce cas : ' l'écriture du fichier de sortie reste suspendue (i_byte_check ≠ 0) ' et les octets restent stockés dans le buffer. if ubound(array_match_found_1) >= 0 then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & array_bytes_to_find_3_2D(i_2, 0) ' WScript.Echo "Les octets du buffer """ & join(array_byte_buffer_1, " ") & """ doivent commencer la/les chaîne(s) """ & join(array_match_found_1, " ") & """" i_byte_check = i_byte_check + 1 ' i_byte_check = 3 end if ' Si le tableau est vide, les 3 octets ne correspondent ' à aucune chaîne à rechercher. C'est la même situation que ' si le 3ème octet ne correspond à aucune case du 3ème tableau. end if i_2 = i_2 + 1 wend ' Si il ne correspond pas, le premier octet est traité, ' c'est-à-dire écrit dans le fichier de sortie puis retiré du buffer. ' De plus i_byte_check est réinitialisée donc on retourne ' à la première boucle de vérification pour vider le buffer. if b_exit_while_1 = FALSE OR ubound(array_match_found_1) < 0 then i_byte_check = 0 file_output.Write(chr(array_byte_buffer_1(i_byte_check))) ' Si le buffer contient plusieurs cases, ' on les décale vers l'arrière et on le raccourcit d'une case. if ubound(array_byte_buffer_1) >= 1 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if ' break case 3 b_exit_while_1 = FALSE i_3 = 0 while i_3 <= array_bytes_to_find_4_2D_ubound AND b_exit_while_1 = FALSE if array_byte_buffer_1(i_byte_check) = array_bytes_to_find_4_2D(i_3, 0) then b_exit_while_1 = TRUE redim array_match_found_2(-1) i_2_2D = 0 b_exit_while_2 = FALSE while i_2_2D <= ubound(array_match_found_1) AND b_exit_while_2 = FALSE if array_match_found_1(i_2_2D) <> "" then i_3_2D = 1 b_exit_while_3 = FALSE while i_3_2D <= ubound(array_bytes_to_find_4_2D, 2) AND b_exit_while_3 = FALSE if array_bytes_to_find_4_2D(i_3, i_3_2D) <> "" then if array_match_found_1(i_2_2D) = array_bytes_to_find_4_2D(i_3, i_3_2D) then redim preserve array_match_found_2(ubound(array_match_found_2) + 1) array_match_found_2(ubound(array_match_found_2)) = array_match_found_1(i_2_2D) end if i_3_2D = i_3_2D + 1 else b_exit_while_3 = TRUE end if wend i_2_2D = i_2_2D + 1 else b_exit_while_2 = TRUE end if wend redim array_match_found_1(ubound(array_match_found_2)) for i = 0 to ubound(array_match_found_2) array_match_found_1(i) = array_match_found_2(i) next if ubound(array_match_found_1) >= 0 then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & array_bytes_to_find_4_2D(i_3, 0) ' WScript.Echo "Les octets du buffer """ & join(array_byte_buffer_1, " ") & """ doivent commencer la/les chaîne(s) """ & join(array_match_found_1, " ") & """" i_byte_check = i_byte_check + 1 ' i_byte_check = 4 end if end if i_3 = i_3 + 1 wend if b_exit_while_1 = FALSE OR ubound(array_match_found_1) < 0 then i_byte_check = 0 file_output.Write(chr(array_byte_buffer_1(i_byte_check))) if ubound(array_byte_buffer_1) >= 1 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if ' break case 4 b_exit_while_1 = FALSE i_4 = 0 while i_4 <= array_bytes_to_find_5_2D_ubound AND b_exit_while_1 = FALSE if array_byte_buffer_1(i_byte_check) = array_bytes_to_find_5_2D(i_4, 0) then b_exit_while_1 = TRUE redim array_match_found_2(-1) i_3_2D = 0 b_exit_while_2 = FALSE while i_3_2D <= ubound(array_match_found_1) AND b_exit_while_2 = FALSE if array_match_found_1(i_3_2D) <> "" then i_4_2D = 1 b_exit_while_3 = FALSE while i_4_2D <= ubound(array_bytes_to_find_5_2D, 2) AND b_exit_while_3 = FALSE if array_bytes_to_find_5_2D(i_4, i_4_2D) <> "" then if array_match_found_1(i_3_2D) = array_bytes_to_find_5_2D(i_4, i_4_2D) then redim preserve array_match_found_2(ubound(array_match_found_2) + 1) array_match_found_2(ubound(array_match_found_2)) = array_match_found_1(i_3_2D) end if i_4_2D = i_4_2D + 1 else b_exit_while_3 = TRUE end if wend i_3_2D = i_3_2D + 1 else b_exit_while_2 = TRUE end if wend redim array_match_found_1(ubound(array_match_found_2)) for i = 0 to ubound(array_match_found_2) array_match_found_1(i) = array_match_found_2(i) next if ubound(array_match_found_1) >= 0 then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & array_bytes_to_find_5_2D(i_4, 0) ' WScript.Echo "Les octets du buffer """ & join(array_byte_buffer_1, " ") & """ doivent commencer la/les chaîne(s) """ & join(array_match_found_1, " ") & """" i_byte_check = i_byte_check + 1 ' i_byte_check = 5 end if end if i_4 = i_4 + 1 wend if b_exit_while_1 = FALSE OR ubound(array_match_found_1) < 0 then i_byte_check = 0 file_output.Write(chr(array_byte_buffer_1(i_byte_check))) if ubound(array_byte_buffer_1) >= 2 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if ' break case else ' On prend le tableau array_match_found_1, il contient le ' (ou les) numéro de case du tableau array_hex_strings_to_find ' qui lui-même contient la chaîne complète des octets à analyser ' dont les 5 premiers octets correspondent. ' Remarque : il se peut que plusieurs chaînes aient leurs 5 premiers ' octets en commun. Voire que seul le dernier octet soit différent. ' Donc on analyse chaque case du tableau array_match_found_1. b_exit_while_1 = FALSE i_5 = 0 ' (Inutile car i_5 reste à 0) while i_5 <= ubound(array_match_found_1) AND b_exit_while_1 = FALSE ' On analyse la chaîne contenue dans array_hex_strings_to_find. ' Si la chaîne continue à correspondre, on teste l'octet suivant. if string(2 - len(hex(array_byte_buffer_1(i_byte_check))), "0") & ucase((hex(array_byte_buffer_1(i_byte_check)))) = mid(array_hex_strings_to_find(array_match_found_1(i_5)), 2 * i_byte_check + 1, 2) then ' WScript.Echo "Étape " & i_byte_check & " - Correspondance trouvée : " & array_byte_buffer_1(i_byte_check) & " = " & mid(array_hex_strings_to_find(array_match_found_1(i_5)), 2 * i_byte_check + 1, 2) b_exit_while_1 = TRUE i_byte_check = i_byte_check + 1 ' Si la chaîne ne correspond plus, alors on retire son numéro du tableau array_match_found_1. ' Et si le tableau est vide, alors aucune chaîne ne correspondait, ' donc le premier octet est traité et i_byte_check est réinitialisée. else if ubound(array_match_found_1) >= 1 then redim array_match_found_2(ubound(array_match_found_1) - 1) for i = 1 to ubound(array_match_found_1) array_match_found_2(i - 1) = array_match_found_1(i) next redim array_match_found_1(ubound(array_match_found_2)) for i = 0 to ubound(array_match_found_2) array_match_found_1(i) = array_match_found_2(i) next else redim array_match_found_1(-1) i_byte_check = 0 file_output.Write(chr(array_byte_buffer_1(i_byte_check))) if ubound(array_byte_buffer_1) >= 1 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - 1) for i = 1 to ubound(array_byte_buffer_1) array_byte_buffer_2(i - 1) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next else redim array_byte_buffer_1(-1) end if end if end if if i_byte_check > 0 then ' Si la correspondance va jusqu'au bout de la chaîne, alors la chaîne a été détectée. if i_byte_check = len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2 then ' Dans ce cas on écrit la nouvelle chaîne et on vide le buffer. for i = 0 to len(array_hex_strings_to_replace(array_match_found_1(i_5))) - 1 step 2 file_output.Write(chr(cbyte("&H" & Mid(array_hex_strings_to_replace(array_match_found_1(i_5)), i + 1, 2)))) next ' WScript.Echo vbCrLf & "Contenu de la chaîne n°" & array_match_found_1(i_5) + 1 & " (" & len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2 & " cases) : " & array_hex_strings_to_find(array_match_found_1(i_5)) & vbCrLf & "Contenu du buffer (" & ubound(array_byte_buffer_1) + 1 & " cases) : " & join(array_byte_buffer_1, " ") ' On vide le buffer de la chaîne à rechercher. if ubound(array_byte_buffer_1) >= len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2 then redim array_byte_buffer_2(ubound(array_byte_buffer_1) - (len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2)) for i = len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2 to ubound(array_byte_buffer_1) step 1 array_byte_buffer_2(i - len(array_hex_strings_to_find(array_match_found_1(i_5))) / 2) = array_byte_buffer_1(i) next redim array_byte_buffer_1(ubound(array_byte_buffer_2)) for i = 0 to ubound(array_byte_buffer_2) array_byte_buffer_1(i) = array_byte_buffer_2(i) next ' WScript.Echo "Contenu restant du buffer = : " & join(array_byte_buffer_1, " ") else redim array_byte_buffer_1(-1) end if i_byte_check = 0 i_replacement_count = i_replacement_count + 1 ' WScript.Echo vbCrLf & "Fichier :" & vbCrLf & file_fullname & vbCrLf & "Séquence n°" & array_match_found_1(i_5) + 1 & " trouvée :" & vbCrLf & array_hex_strings_to_find(array_match_found_1(i_5)) & vbCrLf & "Remplacée par :" & vbCrLf & array_hex_strings_to_replace(array_match_found_1(i_5)) & vbCrLf end if end if wend end select loop file_input.Close file_output.Close i_my_replace_array_hex_strings_in_file = i_replacement_count end function Function i_my_rename_file(byval file_fullname, byval file_fullname_new) if object_file_system.FileExists(file_fullname) = FALSE then MsgBox "Erreur, le fichier :" & vbCrLf & file_fullname & vbCrLf & "n'existe pas, impossible de le renommer en :" & vbCrLf & file_fullname_new, 48, "Erreur" WScript.Quit(0) end if ' WScript.Echo "Le fichier :" & vbCrLf & file_fullname & vbCrLf & "a été renommé en :" & vbCrLf & file_fullname_new & vbCrLf object_file_system.MoveFile file_fullname, file_fullname_new if object_file_system.FileExists(file_fullname_new) = FALSE then MsgBox "Erreur, le fichier :" & vbCrLf & file_fullname & vbCrLf & "n'a pas pu être renommé.", 48, "Erreur" WScript.Quit(0) end if i_my_rename_file = 0 end function function i_my_fix_corrupted_file(byval corrupted_file_error_ori, byval corrupted_file_error_fix, byval corrupted_file) i_installation_type = 0 if program_folder <> "" then if object_file_system.FileExists(program_folder & "\" & corrupted_file) = FALSE then MsgBox "Erreur, fichier non détecté :" & vbCrLf & program_folder & "\" & corrupted_file, 48, "Erreur" WScript.Quit(0) end if i_installation_type = 1 WScript.Echo "Fichier détecté :" & vbCrLf & program_folder & "\" & corrupted_file & vbCrLf end if if object_file_system.FileExists(program_folder_portable_32 & "\" & corrupted_file) = TRUE then i_installation_type = 2 WScript.Echo "Fichier détecté :" & vbCrLf & program_folder_portable_32 & "\" & corrupted_file & vbCrLf end if if object_file_system.FileExists(program_folder_portable_64 & "\" & corrupted_file) = TRUE then i_installation_type = i_installation_type + 3 WScript.Echo "Fichier détecté :" & vbCrLf & program_folder_portable_64 & "\" & corrupted_file & vbCrLf end if if object_file_system.FileExists(program_folder_installed_32 & "\" & corrupted_file) = TRUE then i_installation_type = 6 WScript.Echo "Fichier détecté :" & vbCrLf & program_folder_installed_32 & "\" & corrupted_file & vbCrLf end if if object_file_system.FileExists(program_folder_installed_64 & "\" & corrupted_file) = TRUE then i_installation_type = 7 WScript.Echo "Fichier détecté :" & vbCrLf & program_folder_installed_64 & "\" & corrupted_file & vbCrLf end if if i_installation_type = 0 then MsgBox "Erreur, aucun fichier détecté.", 48, "Erreur" WScript.Quit(0) end if if i_installation_type = 1 then if object_file_system.FileExists(program_folder & "\" & corrupted_file & ".bak") = TRUE then user_response = MsgBox("Attention, le fichier de sauvegarde :" & vbCrLf & program_folder & "\" & corrupted_file & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "appuyez sur ""Oui"" pour supprimer le fichier "".bak"" et continuer," & vbCrLf & "sinon appuyez sur ""Non"" pour quitter." & vbCrLf _ & "Voulez-vous continuer ?", 292, "Question") ' 4 = vbYesNo 32 = vbQuestion 256 = vbDefaultButton2 0 = vbApplicationModal if user_response <> "6" then WScript.Quit(0) end if object_file_system.DeleteFile program_folder & "\" & corrupted_file & ".bak", TRUE WScript.Echo "Le fichier :" & vbCrLf & program_folder & "\" & corrupted_file & ".bak" & vbCrLf & "a été supprimé." end if number_of_replacements = i_my_replace_array_hex_strings_in_file(corrupted_file_error_ori, corrupted_file_error_fix, program_folder & "\" & corrupted_file) WScript.Echo vbCrLf & vbCrLf & number_of_replacements & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & program_folder & "\" & corrupted_file & vbCrLf i_my_rename_file program_folder & "\" & corrupted_file, program_folder & "\" & corrupted_file & ".bak" i_my_rename_file program_folder & "\" & corrupted_file & ".temporary", program_folder & "\" & corrupted_file end if if i_installation_type = 2 OR i_installation_type = 5 then if object_file_system.FileExists(program_folder_portable_32 & "\" & corrupted_file & ".bak") = TRUE then user_response = MsgBox("Attention, le fichier de sauvegarde :" & vbCrLf & program_folder_portable_32 & "\" & corrupted_file & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "appuyez sur ""Oui"" pour supprimer le fichier "".bak"" et continuer," & vbCrLf & "sinon appuyez sur ""Non"" pour quitter." & vbCrLf _ & "Voulez-vous continuer ?", 292, "Question") if user_response <> "6" then WScript.Quit(0) end if object_file_system.DeleteFile program_folder_portable_32 & "\" & corrupted_file & ".bak", TRUE WScript.Echo "Le fichier :" & vbCrLf & program_folder_portable_32 & "\" & corrupted_file & ".bak" & vbCrLf & "a été supprimé." end if number_of_replacements = i_my_replace_array_hex_strings_in_file(corrupted_file_error_ori, corrupted_file_error_fix, program_folder_portable_32 & "\" & corrupted_file) WScript.Echo vbCrLf & vbCrLf & number_of_replacements & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & program_folder_portable_32 & "\" & corrupted_file & vbCrLf i_my_rename_file program_folder_portable_32 & "\" & corrupted_file, program_folder_portable_32 & "\" & corrupted_file & ".bak" i_my_rename_file program_folder_portable_32 & "\" & corrupted_file & ".temporary", program_folder_portable_32 & "\" & corrupted_file end if if i_installation_type = 3 OR i_installation_type = 5 then if object_file_system.FileExists(program_folder_portable_64 & "\" & corrupted_file_1 & ".bak") = TRUE then user_response = MsgBox("Attention, le fichier de sauvegarde :" & vbCrLf & program_folder_portable_64 & "\" & corrupted_file & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "appuyez sur ""Oui"" pour supprimer le fichier "".bak"" et continuer," & vbCrLf & "sinon appuyez sur ""Non"" pour quitter." & vbCrLf _ & "Voulez-vous continuer ?", 292, "Question") if user_response <> "6" then WScript.Quit(0) end if object_file_system.DeleteFile program_folder_portable_64 & "\" & corrupted_file & ".bak", TRUE WScript.Echo "Le fichier :" & vbCrLf & program_folder_portable_64 & "\" & corrupted_file & ".bak" & vbCrLf & "a été supprimé." end if number_of_replacements = i_my_replace_array_hex_strings_in_file(corrupted_file_error_ori, corrupted_file_error_fix, program_folder_portable_64 & "\" & corrupted_file) WScript.Echo vbCrLf & vbCrLf & number_of_replacements & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & program_folder_portable_64 & "\" & corrupted_file & vbCrLf i_my_rename_file program_folder_portable_64 & "\" & corrupted_file, program_folder_portable_64 & "\" & corrupted_file & ".bak" i_my_rename_file program_folder_portable_64 & "\" & corrupted_file & ".temporary", program_folder_portable_64 & "\" & corrupted_file end if if i_installation_type = 6 then if object_file_system.FileExists(program_folder_installed_32 & "\" & corrupted_file_1 & ".bak") = TRUE then user_response = MsgBox("Attention, le fichier de sauvegarde :" & vbCrLf & program_folder_installed_32 & "\" & corrupted_file & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "appuyez sur ""Oui"" pour supprimer le fichier "".bak"" et continuer," & vbCrLf & "sinon appuyez sur ""Non"" pour quitter." & vbCrLf _ & "Voulez-vous continuer ?", 292, "Question") if user_response <> "6" then WScript.Quit(0) end if object_file_system.DeleteFile program_folder_installed_32 & "\" & corrupted_file & ".bak", TRUE WScript.Echo "Le fichier :" & vbCrLf & program_folder_installed_32 & "\" & corrupted_file & ".bak" & vbCrLf & "a été supprimé." end if number_of_replacements = i_my_replace_array_hex_strings_in_file(corrupted_file_error_ori, corrupted_file_error_fix, program_folder_installed_32 & "\" & corrupted_file) WScript.Echo vbCrLf & vbCrLf & number_of_replacements & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & program_folder_installed_32 & "\" & corrupted_file & vbCrLf i_my_rename_file program_folder_installed_32 & "\" & corrupted_file, program_folder_installed_32 & "\" & corrupted_file & ".bak" i_my_rename_file program_folder_installed_32 & "\" & corrupted_file & ".temporary", program_folder_installed_32 & "\" & corrupted_file end if if i_installation_type = 7 then if object_file_system.FileExists(program_folder_installed_64 & "\" & corrupted_file_1 & ".bak") = TRUE then user_response = MsgBox("Attention, le fichier de sauvegarde :" & vbCrLf & program_folder_installed_64 & "\" & corrupted_file & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "appuyez sur ""Oui"" pour supprimer le fichier "".bak"" et continuer," & vbCrLf & "sinon appuyez sur ""Non"" pour quitter." & vbCrLf _ & "Voulez-vous continuer ?", 292, "Question") if user_response <> "6" then WScript.Quit(0) end if object_file_system.DeleteFile program_folder_installed_64 & "\" & corrupted_file & ".bak", TRUE WScript.Echo "Le fichier :" & vbCrLf & program_folder_installed_64 & "\" & corrupted_file & ".bak" & vbCrLf & "a été supprimé." end if number_of_replacements = i_my_replace_array_hex_strings_in_file(corrupted_file_error_ori, corrupted_file_error_fix, program_folder_installed_64 & "\" & corrupted_file) WScript.Echo vbCrLf & vbCrLf & number_of_replacements & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & program_folder_installed_64 & "\" & corrupted_file & vbCrLf i_my_rename_file program_folder_installed_64 & "\" & corrupted_file, program_folder_installed_64 & "\" & corrupted_file & ".bak" i_my_rename_file program_folder_installed_64 & "\" & corrupted_file & ".temporary", program_folder_installed_64 & "\" & corrupted_file end if i_my_fix_corrupted_file = number_of_replacements end function ' _____________________________________________________________________________ ' Partie à modifier pour ajouter des fichiers à corriger : ' Lancement du script : number_of_replacements = i_my_fix_corrupted_file(corrupted_file_1_error_ori, corrupted_file_1_error_fix, corrupted_file_1) number_of_replacements = i_my_fix_corrupted_file(corrupted_file_2_error_ori, corrupted_file_2_error_fix, corrupted_file_2) ' _____________________________________________________________________________ ' Partie à ne pas modifier : pause_message = "L'exécution de ce programme est terminée." MsgBox pause_message & vbCrLf & vbCrLf & "Appuyez sur une touche pour continuer...", 64, "Pause" ' 0 = vbOKOnly vbDefaultButton1 vbApplicationModal 64 = vbInformation WScript.Quit(0)
  5. On appelle ça la paresse intellectuelle, c'est le grand mal de notre temps. C'est le principe de la philosophie, des maths ou de tout raisonnement logique : faut prendre le temps de lire la démonstration. Si je te dis "la laïcité est une erreur", "le suffrage universel est une erreur", "l'Islam n'est pas une religion mais un système politique incompatible avec notre société", "les transgenres sont des malades mentaux", "notre société va vers la guerre civile", "les athées sont soit des paumés, soit des cons", etc. Va toujours y avoir des cons pour dire "NAN C PA VRÊ !". L'important n'est pas la conclusion, mais toute la démonstration qui y mène. Tu n'as pas dû lire ma démonstration, j'ai déjà répondu à tout ça 😅
  6. PS : Zut, une petite erreur relevée, point 3 : Le mot "testicule" est masculin, j'aurais dû prendre le mot "couille".
  7. Code pour Firefox : Sur le bureau de Windows, créez un nouveau document texte (extension ".txt"). Ouvrez-le, puis allez dans Fichier > Enregistrer sous... et dans "Encodage" mettez "UTF-16 LE" ("Unicode" sous Windows 7). Ensuite, copié-collez le code en Powershsell ci-dessous dans le fichier. # Character encoding = UTF-16 LE (Byte Order Mark = FF FE) # End-of-line = Windows (CR LF) # Composants requis : $current_folder = $PWD.Path # Emplacement personnalisé du dossier contenant le fichier "firefox.exe". # Vous pouvez le laisser vide. Exemple : # $firefox_folder = "$current_folder\Mozilla Firefox" $firefox_folder = "" # Emplacements connus : $firefox_folder_portable_32 = "$current_folder\App\Firefox" $firefox_folder_portable_64 = "$current_folder\App\Firefox64" $firefox_folder_installed_32 = "${env:ProgramFiles(x86)}\Mozilla Firefox" $firefox_folder_installed_64 = "${$env:ProgramFiles}\Mozilla Firefox" # Fichiers à réparer : $firefox_corrupted_file_1 = "omni.ja" $firefox_corrupted_file_2 = "browser\omni.ja" # Réparations à faire : $firefox_corrupted_file_1_error_ori = @() $firefox_corrupted_file_1_error_fix = @() $firefox_corrupted_file_2_error_ori = @() $firefox_corrupted_file_2_error_fix = @() $firefox_corrupted_file_1_error_ori += "7574696C69736174657572C2B774726963650A" $firefox_corrupted_file_1_error_fix += "7574696C697361746575720A0A0A0A0A0A0A0A" # utilisateur·trice => utilisateur $firefox_corrupted_file_2_error_ori += "61646D696E697374726174657572C2B7747269636520612064C3A9736163746976C3A9206C612073796E6368726F6E69736174696F6E2E0A" $firefox_corrupted_file_2_error_fix += "61646D696E69737472617465757220612064C3A9736163746976C3A9206C612073796E6368726F6E69736174696F6E2E0A0A0A0A0A0A0A0A" # administrateur·trice a désactivé la synchronisation. => administrateur a désactivé la synchronisation. $firefox_corrupted_file_2_error_ori += "636F6E6E656374C3A9C2B7652E0A" $firefox_corrupted_file_2_error_fix += "636F6E6E656374C3A92E0A0A0A0A" # connecté·e. => connecté. $firefox_corrupted_file_2_error_ori += "636F6E6E656374C3A9C2B76520617665632073756363C3A8730A" $firefox_corrupted_file_2_error_fix += "636F6E6E656374C3A920617665632073756363C3A8730A0A0A0A" # connecté·e avec succès => connecté avec succès $firefox_corrupted_file_2_error_ori += "636F6E6E656374C3A9C2B7650A" $firefox_corrupted_file_2_error_fix += "636F6E6E656374C3A90A0A0A0A" # connecté·e => connecté $firefox_corrupted_file_2_error_ori += "7375697669C2B7650A" $firefox_corrupted_file_2_error_fix += "73756976690A0A0A0A" # suivi·e=> suivi $firefox_corrupted_file_2_error_ori += "5072C3AA74C2B76520C3A0207363616E6E65723C2F7374726F6E673E206574206D61696E74656E657A20766F74726520617070617265696C2061752D64657373757320646520636520636F64650A" $firefox_corrupted_file_2_error_fix += "5072C3AA7420C3A0207363616E6E65723C2F7374726F6E673E206574206D61696E74656E657A20766F74726520617070617265696C2061752D64657373757320646520636520636F64650A0A0A0A" # Prêt·e à scanner</strong> et maintenez votre appareil au-dessus de ce code => Prêt à scanner</strong> et maintenez votre appareil au-dessus de ce code $firefox_corrupted_file_2_error_ori += "70697374C3A9C2B7650A" $firefox_corrupted_file_2_error_fix += "70697374C3A90A0A0A0A" # pisté·e => pisté $i_installation_type = 0 if ($firefox_folder -ne "") { if (-not (Test-Path "$firefox_folder\$firefox_corrupted_file_1")) { Write-Host "Erreur, fichier non détecté :`r`n$firefox_folder\$firefox_corrupted_file_1" Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if (-not (Test-Path "$firefox_folder\$firefox_corrupted_file_2")) { Write-Host "Erreur, fichier non détecté :`r`n$firefox_folder\$firefox_corrupted_file_2" Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } $i_installation_type = 1 Write-Host "Fichiers détectés :`r`n$firefox_folder\$firefox_corrupted_file_1`r`n$firefox_folder\$firefox_corrupted_file_2`r`n" } if (Test-Path "$firefox_folder_portable_32\$firefox_corrupted_file_1") { if (-not (Test-Path "$firefox_folder_portable_32\$firefox_corrupted_file_2")) { Write-Host "Erreur, le second fichier :`r`n$firefox_folder_portable_32\$firefox_corrupted_file_2" "n'a pas été détecté alors que le premier l'a été :`r`n$firefox_folder_portable_32\$firefox_corrupted_file_1" Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } $i_installation_type = 2 Write-Host "Fichiers détectés :`r`n$firefox_folder_portable_32\$firefox_corrupted_file_1`r`n$firefox_folder_portable_32\$firefox_corrupted_file_2`r`n" } if (Test-Path "$firefox_folder_portable_64\$firefox_corrupted_file_1") { if (-not (Test-Path "$firefox_folder_portable_64\$firefox_corrupted_file_2")) { Write-Host "Erreur, le second fichier :`r`n$firefox_folder_portable_64\$firefox_corrupted_file_2" "n'a pas été détecté alors que le premier l'a été :`r`n$firefox_folder_portable_64\$firefox_corrupted_file_1" Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } $i_installation_type += 3 Write-Host "Fichiers détectés :`r`n$firefox_folder_portable_64\$firefox_corrupted_file_1`r`n$firefox_folder_portable_64\$firefox_corrupted_file_2`r`n" } if (Test-Path "$firefox_folder_installed_32\$firefox_corrupted_file_1") { if (-not (Test-Path "$firefox_folder_installed_32\$firefox_corrupted_file_2")) { Write-Host "Erreur, le second fichier :`r`n$firefox_folder_installed_32\$firefox_corrupted_file_2" "n'a pas été détecté alors que le premier l'a été :`r`n$firefox_folder_installed_32\$firefox_corrupted_file_1" Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } $i_installation_type = 6 Write-Host "Fichiers détectés :`r`n$firefox_folder_portable_32\$firefox_corrupted_file_1`r`n$firefox_folder_portable_32\$firefox_corrupted_file_2`r`n" } if (Test-Path "$firefox_folder_installed_64\$firefox_corrupted_file_1") { if (-not (Test-Path "$firefox_folder_installed_64\$firefox_corrupted_file_2")) { Write-Host "Erreur, le second fichier :`r`n$firefox_folder_installed_64\$firefox_corrupted_file_2" "n'a pas été détecté alors que le premier l'a été :`r`n$firefox_folder_installed_64\$firefox_corrupted_file_1" Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } $i_installation_type = 7 Write-Host "Fichiers détectés :`r`n$firefox_folder_portable_64\$firefox_corrupted_file_1`r`n$firefox_folder_portable_64\$firefox_corrupted_file_2`r`n" } if ($i_installation_type -eq 0) { Write-Host "Erreur, aucun fichier détecté." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if ($i_installation_type -eq 1) { if (Test-Path -Path "$firefox_folder\$firefox_corrupted_file_1.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$firefox_folder\$firefox_corrupted_file_1.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if (Test-Path -Path "$firefox_folder\$firefox_corrupted_file_2.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$firefox_folder\$firefox_corrupted_file_2.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 2 -or $i_installation_type -eq 5) { if (Test-Path -Path "$firefox_folder_portable_32\$firefox_corrupted_file_1.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$firefox_folder_portable_32\$firefox_corrupted_file_1.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if (Test-Path -Path "$firefox_folder_portable_32\$firefox_corrupted_file_2.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$firefox_folder_portable_32\$firefox_corrupted_file_2.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 3 -or $i_installation_type -eq 5) { if (Test-Path -Path "$firefox_folder_portable_64\$firefox_corrupted_file_1.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$firefox_folder_portable_64\$firefox_corrupted_file_1.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if (Test-Path -Path "$firefox_folder_portable_64\$firefox_corrupted_file_2.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$firefox_folder_portable_64\$firefox_corrupted_file_2.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 6) { if (Test-Path -Path "$firefox_folder_installed_32\$firefox_corrupted_file_1.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$firefox_folder_installed_32\$firefox_corrupted_file_1.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if (Test-Path -Path "$firefox_folder_installed_32\$firefox_corrupted_file_2.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$firefox_folder_installed_32\$firefox_corrupted_file_2.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 7) { if (Test-Path -Path "$firefox_folder_installed_64\$firefox_corrupted_file_1.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$firefox_folder_installed_64\$firefox_corrupted_file_1.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if (Test-Path -Path "$firefox_folder_installed_64\$firefox_corrupted_file_2.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$firefox_folder_installed_64\$firefox_corrupted_file_2.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($firefox_corrupted_file_1_error_ori.Length -ne $firefox_corrupted_file_1_error_fix.Length) { Write-Host "Erreur :`r`nLe nombre de cases dans le tableau des chaînes hexadécimales à détecter`r`net dans le tableau des chaînes hexadécimales à remplacer n'est pas identique." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if ($firefox_corrupted_file_2_error_ori.Length -ne $firefox_corrupted_file_2_error_fix.Length) { Write-Host "Erreur :`r`nLe nombre de cases dans le tableau des chaînes hexadécimales à détecter`r`net dans le tableau des chaînes hexadécimales à remplacer n'est pas identique." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } for ($i = 0; $i -le $firefox_corrupted_file_1_error_ori.Length - 1; $i += 1) { # Write-Host $($firefox_corrupted_file_1_error_ori[$i]) = $($firefox_corrupted_file_1_error_ori[$i].Length)`r`n$($firefox_corrupted_file_1_error_fix[$i]) = $($firefox_corrupted_file_1_error_fix[$i].Length) if ($firefox_corrupted_file_1_error_ori[$i].Length -ne $firefox_corrupted_file_1_error_fix[$i].Length) { Write-Host "Erreur :`r`nLa variable ""$($firefox_corrupted_file_1_error_ori[$i])"" et`r`nla variable ""$($firefox_corrupted_file_1_error_fix[$i])""" "n'ont pas le même nombre de caractères." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if ($firefox_corrupted_file_1_error_ori[$i].Length % 2 -ne 0) { Write-Host "Erreur, les variables :`r`n$($firefox_corrupted_file_1_error_ori[$i])`r`n$($firefox_corrupted_file_1_error_fix[$i])`r`nont un nombre impair de caractères." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if ($firefox_corrupted_file_1_error_ori[$i].Length -lt 12) { Write-Host "Erreur, les variables :`r`n$($firefox_corrupted_file_1_error_ori[$i])`r`n$($firefox_corrupted_file_1_error_fix[$i])`r`ndoivent avoir au moins 12 caractères hexadécimaux" ` "`r`npour représenter au moins 6 octets.`r`nOr ici, elles n'en contiennent que $($firefox_corrupted_file_1_error_ori[$i].Length)." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } for ($i = 0; $i -le $firefox_corrupted_file_2_error_ori.Length - 1; $i += 1) { # Write-Host $($firefox_corrupted_file_2_error_ori[$i]) = $($firefox_corrupted_file_2_error_ori[$i].Length)`r`n$($firefox_corrupted_file_2_error_fix[$i]) = $($firefox_corrupted_file_2_error_fix[$i].Length) if ($firefox_corrupted_file_2_error_ori[$i].Length -ne $firefox_corrupted_file_2_error_fix[$i].Length) { Write-Host "Erreur :`r`nLa variable ""$($firefox_corrupted_file_2_error_ori[$i])"" et`r`nla variable ""$($firefox_corrupted_file_2_error_fix[$i])""" "n'ont pas le même nombre de caractères." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if ($firefox_corrupted_file_2_error_ori[$i].Length % 2 -ne 0) { Write-Host "Erreur, les variables :`r`n$($firefox_corrupted_file_2_error_ori[$i])`r`n$($firefox_corrupted_file_2_error_fix[$i])`r`nont un nombre impair de caractères." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if ($firefox_corrupted_file_2_error_ori[$i].Length -lt 12) { Write-Host "Erreur, les variables :`r`n$($firefox_corrupted_file_2_error_ori[$i])`r`n$($firefox_corrupted_file_2_error_fix[$i])`r`ndoivent avoir au moins 12 caractères hexadécimaux" ` "`r`npour représenter au moins 6 octets.`r`nOr ici, elles n'en contiennent que $($firefox_corrupted_file_2_error_ori[$i].Length)." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 1) { Out-File -FilePath "$firefox_folder\$firefox_corrupted_file_1.temporary" -Force -Encoding ASCII # (Force = Écraser si existe déjà) (Encoding ASCII = Utiliser ASCII au lieu d'Unicode UTF16LE donc pas de Byte Order Mark FFFE) if (-not (Test-Path "$firefox_folder\$firefox_corrupted_file_1.temporary")) { Write-Host "Erreur, le fichier :`r`n$firefox_folder\$firefox_corrupted_file_1.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } Out-File -FilePath "$firefox_folder\$firefox_corrupted_file_2.temporary" -Force -Encoding ASCII if (-not (Test-Path "$firefox_folder\$firefox_corrupted_file_2.temporary")) { Write-Host "Erreur, le fichier :`r`n$firefox_folder\$firefox_corrupted_file_2.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 2 -or $i_installation_type -eq 5) { Out-File -FilePath "$firefox_folder_portable_32\$firefox_corrupted_file_1.temporary" -Force -Encoding ASCII if (-not (Test-Path "$firefox_folder_portable_32\$firefox_corrupted_file_1.temporary")) { Write-Host "Erreur, le fichier :`r`n$firefox_folder_portable_32\$firefox_corrupted_file_1.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } Out-File -FilePath "$firefox_folder_portable_32\$firefox_corrupted_file_2.temporary" -Force -Encoding ASCII if (-not (Test-Path "$firefox_folder_portable_32\$firefox_corrupted_file_2.temporary")) { Write-Host "Erreur, le fichier :`r`n$firefox_folder_portable_32\$firefox_corrupted_file_2.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 3 -or $i_installation_type -eq 5) { Out-File -FilePath "$firefox_folder_portable_64\$firefox_corrupted_file_1.temporary" -Force -Encoding ASCII if (-not (Test-Path "$firefox_folder_portable_64\$firefox_corrupted_file_1.temporary")) { Write-Host "Erreur, le fichier :`r`n$firefox_folder_portable_64\$firefox_corrupted_file_1.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } Out-File -FilePath "$firefox_folder_portable_64\$firefox_corrupted_file_2.temporary" -Force -Encoding ASCII if (-not (Test-Path "$firefox_folder_portable_64\$firefox_corrupted_file_2.temporary")) { Write-Host "Erreur, le fichier :`r`n$firefox_folder_portable_64\$firefox_corrupted_file_2.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 6) { Out-File -FilePath "$firefox_folder_installed_32\$firefox_corrupted_file_1.temporary" -Force -Encoding ASCII if (-not (Test-Path "$firefox_folder_installed_32\$firefox_corrupted_file_1.temporary")) { Write-Host "Erreur, le fichier :`r`n$firefox_folder_installed_32\$firefox_corrupted_file_1.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } Out-File -FilePath "$firefox_folder_installed_32\$firefox_corrupted_file_2.temporary" -Force -Encoding ASCII if (-not (Test-Path "$firefox_folder_installed_32\$firefox_corrupted_file_2.temporary")) { Write-Host "Erreur, le fichier :`r`n$firefox_folder_installed_32\$firefox_corrupted_file_2.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 7) { Out-File -FilePath "$firefox_folder_installed_64\$firefox_corrupted_file_1.temporary" -Force -Encoding ASCII if (-not (Test-Path "$firefox_folder_installed_64\$firefox_corrupted_file_1.temporary")) { Write-Host "Erreur, le fichier :`r`n$firefox_folder_installed_64\$firefox_corrupted_file_1.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } Out-File -FilePath "$firefox_folder_installed_64\$firefox_corrupted_file_2.temporary" -Force -Encoding ASCII if (-not (Test-Path "$firefox_folder_installed_64\$firefox_corrupted_file_2.temporary")) { Write-Host "Erreur, le fichier :`r`n$firefox_folder_installed_64\$firefox_corrupted_file_2.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } function i_my_replace_array_hex_strings_in_file([string[]]$array_hex_strings_to_find, [string[]]$array_hex_strings_to_replace, [string]$file_fullname) { $file_input = [System.IO.File]::OpenRead($file_fullname) # Ouverture du fichier en lecture $file_output = [System.IO.File]::Create("$file_fullname.temporary") # Ouverture du fichier en écriture $byte_buffer_read = New-Object byte[] 1 $byte_buffer = New-Object byte[] 0 $i_byte_check = 0 $b_replacement_done = $false $i_replacement_count = 0 $i_1 = 0 while ($file_input.Read($byte_buffer_read, 0, 1) -ne 0) { $byte_read = $byte_buffer_read[0] # $character_read = [char]$byte_read # Write-Host "Caractère lu (code $($byte_read.ToString("X2"))) : $character_read" if ($b_replacement_done -eq $false) { # Pour aller plus vite, extraction des 5 premiers octets et conversion en décimal $byte_to_find_1 = [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(0, 2), 16) $byte_to_find_2 = [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(2, 2), 16) $byte_to_find_3 = [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(4, 2), 16) $byte_to_find_4 = [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(6, 2), 16) $byte_to_find_5 = [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(8, 2), 16) $b_replacement_done = $true } switch ($i_byte_check) { 0 { if ($byte_read -eq $byte_to_find_1) { $byte_buffer += $byte_read $i_byte_check = 1 } break } 1 { if ($byte_read -eq $byte_to_find_2) { $byte_buffer += $byte_read $i_byte_check = 2 } else { $file_output.Write($byte_buffer, 0, $byte_buffer.Length) $byte_buffer = @() $i_byte_check = 0 } break } 2 { if ($byte_read -eq $byte_to_find_3) { $byte_buffer += $byte_read $i_byte_check = 3 } else { $file_output.Write($byte_buffer, 0, $byte_buffer.Length) $byte_buffer = @() $i_byte_check = 0 } break } 3 { if ($byte_read -eq $byte_to_find_4) { $byte_buffer += $byte_read $i_byte_check = 4 } else { $file_output.Write($byte_buffer, 0, $byte_buffer.Length) $byte_buffer = @() $i_byte_check = 0 } break } 4 { if ($byte_read -eq $byte_to_find_5) { $byte_buffer += $byte_read $i_byte_check = 5 } else { $file_output.Write($byte_buffer, 0, $byte_buffer.Length) $byte_buffer = @() $i_byte_check = 0 } break } default { if ($byte_read.ToString("X2") -eq $array_hex_strings_to_find[$i_1].Substring(2 * $i_byte_check, 2)) { $byte_buffer += $byte_read $i_byte_check++ } else { $file_output.Write($byte_buffer, 0, $byte_buffer.Length) $byte_buffer = @() $i_byte_check = 0 } if ($i_byte_check -eq $array_hex_strings_to_find[$i_1].Length / 2) { for ($i_2 = 0; $i_2 -lt $array_hex_strings_to_replace[$i_1].Length; $i_2 += 2) { $file_output.WriteByte([byte]::Parse($array_hex_strings_to_replace[$i_1].Substring($i_2, 2), [System.Globalization.NumberStyles]::HexNumber)) } $byte_buffer = @() $i_byte_check = 0 $b_replacement_done = $false $i_replacement_count++ Write-Host "Fichier :`r`n$file_fullname`r`nSéquence trouvée :`r`n$($array_hex_strings_to_find[$i_1])`r`nRemplacée par :`r`n$($array_hex_strings_to_replace[$i_1])`r`n" if ($i_1 -lt $array_hex_strings_to_find.Length - 1) { $i_1++ } } } } if ($i_byte_check -eq 0 -and $b_replacement_done -eq $true) { $file_output.WriteByte($byte_read) } } $file_input.Close() $file_output.Close() $file_input.Dispose() $file_output.Dispose() return $i_replacement_count } if ($i_installation_type -eq 1) { $number_of_replacements_1 = i_my_replace_array_hex_strings_in_file $firefox_corrupted_file_1_error_ori $firefox_corrupted_file_1_error_fix ("$firefox_folder\$firefox_corrupted_file_1") Write-Host "$number_of_replacements_1 remplacement(s) effectué(s) sur le fichier :`r`n$firefox_folder\$firefox_corrupted_file_1`r`n" $number_of_replacements_2 = i_my_replace_array_hex_strings_in_file $firefox_corrupted_file_2_error_ori $firefox_corrupted_file_2_error_fix ("$firefox_folder\$firefox_corrupted_file_2") Write-Host "$number_of_replacements_2 remplacement(s) effectué(s) sur le fichier :`r`n$firefox_folder\$firefox_corrupted_file_2`r`n" } if ($i_installation_type -eq 2 -or $i_installation_type -eq 5) { $number_of_replacements_1 = i_my_replace_array_hex_strings_in_file $firefox_corrupted_file_1_error_ori $firefox_corrupted_file_1_error_fix ("$firefox_folder_portable_32\$firefox_corrupted_file_1") Write-Host "$number_of_replacements_1 remplacement(s) effectué(s) sur le fichier :`r`n$firefox_folder_portable_32\$firefox_corrupted_file_1`r`n" $number_of_replacements_2 = i_my_replace_array_hex_strings_in_file $firefox_corrupted_file_2_error_ori $firefox_corrupted_file_2_error_fix ("$firefox_folder_portable_32\$firefox_corrupted_file_2") Write-Host "$number_of_replacements_2 remplacement(s) effectué(s) sur le fichier :`r`n$firefox_folder_portable_32\$firefox_corrupted_file_2`r`n" } if ($i_installation_type -eq 3 -or $i_installation_type -eq 5) { $number_of_replacements_1 = i_my_replace_array_hex_strings_in_file $firefox_corrupted_file_1_error_ori $firefox_corrupted_file_1_error_fix ("$firefox_folder_portable_64\$firefox_corrupted_file_1") Write-Host "$number_of_replacements_1 remplacement(s) effectué(s) sur le fichier :`r`n$firefox_folder_portable_64\$firefox_corrupted_file_1`r`n" $number_of_replacements_2 = i_my_replace_array_hex_strings_in_file $firefox_corrupted_file_2_error_ori $firefox_corrupted_file_2_error_fix ("$firefox_folder_portable_64\$firefox_corrupted_file_2") Write-Host "$number_of_replacements_2 remplacement(s) effectué(s) sur le fichier :`r`n$firefox_folder_portable_64\$firefox_corrupted_file_2`r`n" } if ($i_installation_type -eq 6) { $number_of_replacements_1 = i_my_replace_array_hex_strings_in_file $firefox_corrupted_file_1_error_ori $firefox_corrupted_file_1_error_fix ("$firefox_folder_installed_32\$firefox_corrupted_file_1") Write-Host "$number_of_replacements_1 remplacement(s) effectué(s) sur le fichier :`r`n$firefox_folder_installed_32\$firefox_corrupted_file_1`r`n" $number_of_replacements_2 = i_my_replace_array_hex_strings_in_file $firefox_corrupted_file_2_error_ori $firefox_corrupted_file_2_error_fix ("$firefox_folder_installed_32\$firefox_corrupted_file_2") Write-Host "$number_of_replacements_2 remplacement(s) effectué(s) sur le fichier :`r`n$firefox_folder_installed_32\$firefox_corrupted_file_2`r`n" } if ($i_installation_type -eq 7) { $number_of_replacements_1 = i_my_replace_array_hex_strings_in_file $firefox_corrupted_file_1_error_ori $firefox_corrupted_file_1_error_fix ("$firefox_folder_installed_64\$firefox_corrupted_file_1") Write-Host "$number_of_replacements_1 remplacement(s) effectué(s) sur le fichier :`r`n$firefox_folder_installed_64\$firefox_corrupted_file_1`r`n" $number_of_replacements_2 = i_my_replace_array_hex_strings_in_file $firefox_corrupted_file_2_error_ori $firefox_corrupted_file_2_error_fix ("$firefox_folder_installed_64\$firefox_corrupted_file_2") Write-Host "$number_of_replacements_2 remplacement(s) effectué(s) sur le fichier :`r`n$firefox_folder_installed_64\$firefox_corrupted_file_2`r`n" } function i_my_rename_file([string]$file_fullname, [string]$file_fullname_new) { if (-not (Test-Path $file_fullname)) { Write-Host "Erreur, le fichier :`r`n$file_fullname`r`nn'existe pas, impossible de le renommer en :`r`n$file_fullname_new" Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } # Write-Host "On renomme le fichier :`r`n$file_fullname`r`nen :`r`n$file_fullname_new" Rename-Item -Path $file_fullname -NewName $file_fullname_new -ErrorAction Stop if (-not (Test-Path $file_fullname_new)) { Write-Host "Erreur, le fichier :`r`n$file_fullname`r`nn'a pas pu être renommé." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } return 0 } if ($i_installation_type -eq 1) { $i_return = i_my_rename_file "$firefox_folder\$firefox_corrupted_file_1" "$firefox_folder\$firefox_corrupted_file_1.bak" $i_return = i_my_rename_file "$firefox_folder\$firefox_corrupted_file_1.temporary" "$firefox_folder\$firefox_corrupted_file_1" $i_return = i_my_rename_file "$firefox_folder\$firefox_corrupted_file_2" "$firefox_folder\$firefox_corrupted_file_2.bak" $i_return = i_my_rename_file "$firefox_folder\$firefox_corrupted_file_2.temporary" "$firefox_folder\$firefox_corrupted_file_2" } if ($i_installation_type -eq 2 -or $i_installation_type -eq 5) { $i_return = i_my_rename_file "$firefox_folder_portable_32\$firefox_corrupted_file_1" "$firefox_folder_portable_32\$firefox_corrupted_file_1.bak" $i_return = i_my_rename_file "$firefox_folder_portable_32\$firefox_corrupted_file_1.temporary" "$firefox_folder_portable_32\$firefox_corrupted_file_1" $i_return = i_my_rename_file "$firefox_folder_portable_32\$firefox_corrupted_file_2" "$firefox_folder_portable_32\$firefox_corrupted_file_2.bak" $i_return = i_my_rename_file "$firefox_folder_portable_32\$firefox_corrupted_file_2.temporary" "$firefox_folder_portable_32\$firefox_corrupted_file_2" } if ($i_installation_type -eq 3 -or $i_installation_type -eq 5) { $i_return = i_my_rename_file "$firefox_folder_portable_64\$firefox_corrupted_file_1" "$firefox_folder_portable_64\$firefox_corrupted_file_1.bak" $i_return = i_my_rename_file "$firefox_folder_portable_64\$firefox_corrupted_file_1.temporary" "$firefox_folder_portable_64\$firefox_corrupted_file_1" $i_return = i_my_rename_file "$firefox_folder_portable_64\$firefox_corrupted_file_2" "$firefox_folder_portable_64\$firefox_corrupted_file_2.bak" $i_return = i_my_rename_file "$firefox_folder_portable_64\$firefox_corrupted_file_2.temporary" "$firefox_folder_portable_64\$firefox_corrupted_file_2" } if ($i_installation_type -eq 6) { $i_return = i_my_rename_file "$firefox_folder_installed_32\$firefox_corrupted_file_1" "$firefox_folder_installed_32\$firefox_corrupted_file_1.bak" $i_return = i_my_rename_file "$firefox_folder_installed_32\$firefox_corrupted_file_1.temporary" "$firefox_folder_installed_32\$firefox_corrupted_file_1" $i_return = i_my_rename_file "$firefox_folder_installed_32\$firefox_corrupted_file_2" "$firefox_folder_installed_32\$firefox_corrupted_file_2.bak" $i_return = i_my_rename_file "$firefox_folder_installed_32\$firefox_corrupted_file_2.temporary" "$firefox_folder_installed_32\$firefox_corrupted_file_2" } if ($i_installation_type -eq 7) { $i_return = i_my_rename_file "$firefox_folder_installed_64\$firefox_corrupted_file_1" "$firefox_folder_installed_64\$firefox_corrupted_file_1.bak" $i_return = i_my_rename_file "$firefox_folder_installed_64\$firefox_corrupted_file_1.temporary" "$firefox_folder_installed_64\$firefox_corrupted_file_1" $i_return = i_my_rename_file "$firefox_folder_installed_64\$firefox_corrupted_file_2" "$firefox_folder_installed_64\$firefox_corrupted_file_2.bak" $i_return = i_my_rename_file "$firefox_folder_installed_64\$firefox_corrupted_file_2.temporary" "$firefox_folder_installed_64\$firefox_corrupted_file_2" } Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 Enregistrez et fermez le fichier, puis changez son extension ".txt" en ".ps1". Si vous avez Firefox Portable, vous pouvez renommer le fichier en "FirefoxPortable - Supprimer écriture inclusive.ps1" par exemple. Ensuite il faut placer le fichier script dans le dossier racine, par exemple : "D:\Programs\PortableApps\PortableApps\FirefoxPortable". Si vous avez installé Firefox, vous pouvez mettre ce fichier depuis n'importe où. Pour une autre installation, il vous suffit de modifier le début du script pour renseigner l'emplacement. Ensuite double-cliquez dessus pour nettoyer les fichiers corrompus. Bonus : voici une version du script en VisualBasic Script (exécutable en mode fenêtre ou en mode console). C'est plus lent mais si vous n'arrivez pas à utiliser le PowerShell, ça fonctionnera aussi : ' Character encoding = UTF-16 LE (Byte Order Mark = FF FE) ' End-of-line = Windows (CR LF) ' Composants requis : set object_shell = WScript.CreateObject("WScript.Shell") set object_file_system = WScript.CreateObject("Scripting.FileSystemObject") current_folder = object_file_system.GetParentFolderName(WScript.ScriptFullName) ' Emplacement personnalisé du dossier contenant le fichier "firefox.exe". ' Vous pouvez le laisser vide. Exemple : ' firefox_folder = current_folder & "\Mozilla Firefox" firefox_folder = "" ' Emplacements connus : firefox_folder_portable_32 = current_folder & "\App\Firefox" firefox_folder_portable_64 = current_folder & "\App\Firefox64" firefox_folder_installed_32 = object_shell.ExpandEnvironmentStrings("%ProgramFiles(x86)%") & "\Mozilla Firefox" firefox_folder_installed_64 = object_shell.ExpandEnvironmentStrings("%ProgramFiles%") & "\Mozilla Firefox" ' Fichiers à réparer : firefox_corrupted_file_1 = "omni.ja" firefox_corrupted_file_2 = "browser\omni.ja" ' Réparations à faire : dim firefox_corrupted_file_1_error_ori() dim firefox_corrupted_file_1_error_fix() dim firefox_corrupted_file_2_error_ori() dim firefox_corrupted_file_2_error_fix() redim preserve firefox_corrupted_file_1_error_ori(0) redim preserve firefox_corrupted_file_1_error_fix(0) firefox_corrupted_file_1_error_ori(0) = "7574696C69736174657572C2B774726963650A" firefox_corrupted_file_1_error_fix(0) = "7574696C697361746575720A0A0A0A0A0A0A0A" ' utilisateur·trice => utilisateur redim preserve firefox_corrupted_file_2_error_ori(0) redim preserve firefox_corrupted_file_2_error_fix(0) firefox_corrupted_file_2_error_ori(0) = "61646D696E697374726174657572C2B7747269636520612064C3A9736163746976C3A9206C612073796E6368726F6E69736174696F6E2E0A" firefox_corrupted_file_2_error_fix(0) = "61646D696E69737472617465757220612064C3A9736163746976C3A9206C612073796E6368726F6E69736174696F6E2E0A0A0A0A0A0A0A0A" ' administrateur·trice a désactivé la synchronisation. => administrateur a désactivé la synchronisation. redim preserve firefox_corrupted_file_2_error_ori(ubound(firefox_corrupted_file_2_error_ori) + 1) redim preserve firefox_corrupted_file_2_error_fix(ubound(firefox_corrupted_file_2_error_fix) + 1) firefox_corrupted_file_2_error_ori(1) = "636F6E6E656374C3A9C2B7652E0A" firefox_corrupted_file_2_error_fix(1) = "636F6E6E656374C3A92E0A0A0A0A" ' connecté·e. => connecté. redim preserve firefox_corrupted_file_2_error_ori(ubound(firefox_corrupted_file_2_error_ori) + 1) redim preserve firefox_corrupted_file_2_error_fix(ubound(firefox_corrupted_file_2_error_fix) + 1) firefox_corrupted_file_2_error_ori(2) = "636F6E6E656374C3A9C2B76520617665632073756363C3A8730A" firefox_corrupted_file_2_error_fix(2) = "636F6E6E656374C3A920617665632073756363C3A8730A0A0A0A" ' connecté·e avec succès => connecté avec succès redim preserve firefox_corrupted_file_2_error_ori(ubound(firefox_corrupted_file_2_error_ori) + 1) redim preserve firefox_corrupted_file_2_error_fix(ubound(firefox_corrupted_file_2_error_fix) + 1) firefox_corrupted_file_2_error_ori(3) = "636F6E6E656374C3A9C2B7650A" firefox_corrupted_file_2_error_fix(3) = "636F6E6E656374C3A90A0A0A0A" ' connecté·e => connecté redim preserve firefox_corrupted_file_2_error_ori(ubound(firefox_corrupted_file_2_error_ori) + 1) redim preserve firefox_corrupted_file_2_error_fix(ubound(firefox_corrupted_file_2_error_fix) + 1) firefox_corrupted_file_2_error_ori(4) = "7375697669C2B7650A" firefox_corrupted_file_2_error_fix(4) = "73756976690A0A0A0A" ' suivi·e=> suivi redim preserve firefox_corrupted_file_2_error_ori(ubound(firefox_corrupted_file_2_error_ori) + 1) redim preserve firefox_corrupted_file_2_error_fix(ubound(firefox_corrupted_file_2_error_fix) + 1) firefox_corrupted_file_2_error_ori(5) = "5072C3AA74C2B76520C3A0207363616E6E65723C2F7374726F6E673E206574206D61696E74656E657A20766F74726520617070617265696C2061752D64657373757320646520636520636F64650A" firefox_corrupted_file_2_error_fix(5) = "5072C3AA7420C3A0207363616E6E65723C2F7374726F6E673E206574206D61696E74656E657A20766F74726520617070617265696C2061752D64657373757320646520636520636F64650A0A0A0A" ' Prêt·e à scanner</strong> et maintenez votre appareil au-dessus de ce code => Prêt à scanner</strong> et maintenez votre appareil au-dessus de ce code redim preserve firefox_corrupted_file_2_error_ori(ubound(firefox_corrupted_file_2_error_ori) + 1) redim preserve firefox_corrupted_file_2_error_fix(ubound(firefox_corrupted_file_2_error_fix) + 1) firefox_corrupted_file_2_error_ori(6) = "70697374C3A9C2B7650A" firefox_corrupted_file_2_error_fix(6) = "70697374C3A90A0A0A0A" ' pisté·e => pisté i_installation_type = 0 if firefox_folder <> "" then if object_file_system.FileExists(firefox_folder & "\" & firefox_corrupted_file_1) = FALSE then WScript.Echo "Erreur, fichier non détecté :" & vbCrLf & firefox_folder & "\" & firefox_corrupted_file_1 WScript.Sleep 5000 WScript.Quit(0) end if if object_file_system.FileExists(firefox_folder & "\" & firefox_corrupted_file_2) = FALSE then WScript.Echo "Erreur, fichier non détecté :" & vbCrLf & firefox_folder & "\" & firefox_corrupted_file_2 WScript.Sleep 5000 WScript.Quit(0) end if i_installation_type = 1 WScript.Echo "Fichiers détectés :" & vbCrLf & firefox_folder & "\" & firefox_corrupted_file_1 & vbCrLf & firefox_folder & "\" & firefox_corrupted_file_2 & vbCrLf end if if object_file_system.FileExists(firefox_folder_portable_32 & "\" & firefox_corrupted_file_1) = TRUE then if object_file_system.FileExists(firefox_folder_portable_32 & "\" & firefox_corrupted_file_2) = FALSE then WScript.Echo "Erreur, le second fichier :" & vbCrLf & firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 & vbCrLf _ & "n'a pas été détecté alors que le premier l'a été :" & vbCrLf & firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 WScript.Sleep 5000 WScript.Quit(0) end if i_installation_type = 2 WScript.Echo "Fichiers détectés :" & vbCrLf & firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 & vbCrLf & firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 & vbCrLf end if if object_file_system.FileExists(firefox_folder_portable_64 & "\" & firefox_corrupted_file_1) = TRUE then if object_file_system.FileExists(firefox_folder_portable_64 & "\" & firefox_corrupted_file_2) = FALSE then WScript.Echo "Erreur, le second fichier :" & vbCrLf & firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 & vbCrLf _ & "n'a pas été détecté alors que le premier l'a été :" & vbCrLf & firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 WScript.Sleep 5000 WScript.Quit(0) end if i_installation_type = i_installation_type + 3 WScript.Echo "Fichiers détectés :" & vbCrLf & firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 & vbCrLf & firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 & vbCrLf end if if object_file_system.FileExists(firefox_folder_installed_32 & "\" & firefox_corrupted_file_1) = TRUE then if object_file_system.FileExists(firefox_folder_installed_32 & "\" & firefox_corrupted_file_2) = FALSE then WScript.Echo "Erreur, le second fichier :" & vbCrLf & firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 & vbCrLf _ & "n'a pas été détecté alors que le premier l'a été :" & vbCrLf & firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 WScript.Sleep 5000 WScript.Quit(0) end if i_installation_type = 6 WScript.Echo "Fichiers détectés :" & vbCrLf & firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 & vbCrLf & firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 & vbCrLf end if if object_file_system.FileExists(firefox_folder_installed_64 & "\" & firefox_corrupted_file_1) = TRUE then if object_file_system.FileExists(firefox_folder_installed_64 & "\" & firefox_corrupted_file_2) = FALSE then WScript.Echo "Erreur, le second fichier :" & vbCrLf & firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 & vbCrLf _ & "n'a pas été détecté alors que le premier l'a été :" & vbCrLf & firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 WScript.Sleep 5000 WScript.Quit(0) end if i_installation_type = 7 WScript.Echo "Fichiers détectés :" & vbCrLf & firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 & vbCrLf & firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 & vbCrLf end if if i_installation_type = 0 then WScript.Echo "Erreur, aucun fichier détecté." WScript.Sleep 5000 WScript.Quit(0) end if if i_installation_type = 1 then if object_file_system.FileExists(firefox_folder & "\" & firefox_corrupted_file_1 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & firefox_folder & "\" & firefox_corrupted_file_1 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if if object_file_system.FileExists(firefox_folder & "\" & firefox_corrupted_file_2 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & firefox_folder & "\" & firefox_corrupted_file_2 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 2 OR i_installation_type = 5 then if object_file_system.FileExists(firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if if object_file_system.FileExists(firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 3 OR i_installation_type = 5 then if object_file_system.FileExists(firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if if object_file_system.FileExists(firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 6 then if object_file_system.FileExists(firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if if object_file_system.FileExists(firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 7 then if object_file_system.FileExists(firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if if object_file_system.FileExists(firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if end if if ubound(firefox_corrupted_file_1_error_ori) <> ubound(firefox_corrupted_file_1_error_fix) then WScript.Echo "Erreur :" & vbCrLf & "Le nombre de cases dans le tableau des chaînes hexadécimales à détecter" & vbCrLf & "et dans le tableau des chaînes hexadécimales à remplacer n'est pas identique." WScript.Sleep 5000 WScript.Quit(0) end if if ubound(firefox_corrupted_file_2_error_ori) <> ubound(firefox_corrupted_file_2_error_fix) then WScript.Echo "Erreur :" & vbCrLf & "Le nombre de cases dans le tableau des chaînes hexadécimales à détecter" & vbCrLf & "et dans le tableau des chaînes hexadécimales à remplacer n'est pas identique." WScript.Sleep 5000 WScript.Quit(0) end if for i = 0 to ubound(firefox_corrupted_file_1_error_ori) step 1 ' WScript.Echo firefox_corrupted_file_1_error_ori(i) & " = " & len(firefox_corrupted_file_1_error_ori(i)) & vbCrLf & firefox_corrupted_file_1_error_fix(i) & " = " & len(firefox_corrupted_file_1_error_fix(i)) if len(firefox_corrupted_file_1_error_ori(i)) <> len(firefox_corrupted_file_1_error_fix(i)) then WScript.Echo "Erreur :" & vbCrLf & "La variable """ & firefox_corrupted_file_1_error_ori(i) & """ et" & vbCrLf & "la variable """ & firefox_corrupted_file_1_error_fix(i) & """" & vbCrLf _ & "n'ont pas le même nombre de caractères." WScript.Sleep 5000 WScript.Quit(0) end if if len(firefox_corrupted_file_1_error_ori(i)) MOD 2 <> 0 then WScript.Echo "Erreur, les variables :" & vbCrLf & firefox_corrupted_file_1_error_ori(i) & vbCrLf & firefox_corrupted_file_1_error_fix(i) & vbCrLf & "ont un nombre impair de caractères." WScript.Sleep 5000 WScript.Quit(0) end if if len(firefox_corrupted_file_1_error_ori(i)) < 12 then WScript.Echo "Erreur, les variables :" & vbCrLf & firefox_corrupted_file_1_error_ori(i) & vbCrLf & firefox_corrupted_file_1_error_fix(i) & vbCrLf & "doivent avoir au moins 12 caractères hexadécimaux" _ & vbCrLf & "pour représenter au moins 6 octets." & vbCrLf & "Or ici, elles n'en contiennent que " & len(firefox_corrupted_file_1_error_ori(i)) & "." WScript.Sleep 5000 WScript.Quit(0) end if next for i = 0 to ubound(firefox_corrupted_file_2_error_ori) step 1 ' WScript.Echo firefox_corrupted_file_2_error_ori(i) & " = " & len(firefox_corrupted_file_2_error_ori(i)) & vbCrLf & firefox_corrupted_file_2_error_fix(i) & " = " & len(firefox_corrupted_file_2_error_fix(i)) if len(firefox_corrupted_file_2_error_ori(i)) <> len(firefox_corrupted_file_2_error_fix(i)) then WScript.Echo "Erreur :" & vbCrLf & "La variable """ & firefox_corrupted_file_2_error_ori(i) & """ et" & vbCrLf & "la variable """ & firefox_corrupted_file_2_error_fix(i) & """" & vbCrLf _ & "n'ont pas le même nombre de caractères." WScript.Sleep 5000 WScript.Quit(0) end if if len(firefox_corrupted_file_2_error_ori(i)) MOD 2 <> 0 then WScript.Echo "Erreur, les variables :" & vbCrLf & firefox_corrupted_file_2_error_ori(i) & vbCrLf & firefox_corrupted_file_2_error_fix(i) & vbCrLf & "ont un nombre impair de caractères." WScript.Sleep 5000 WScript.Quit(0) end if if len(firefox_corrupted_file_2_error_ori(i)) < 12 then WScript.Echo "Erreur, les variables :" & vbCrLf & firefox_corrupted_file_2_error_ori(i) & vbCrLf & firefox_corrupted_file_2_error_fix(i) & vbCrLf & "doivent avoir au moins 12 caractères hexadécimaux" _ & vbCrLf & "pour représenter au moins 6 octets." & vbCrLf & "Or ici, elles n'en contiennent que " & len(firefox_corrupted_file_2_error_ori(i)) & "." WScript.Sleep 5000 WScript.Quit(0) end if next if i_installation_type = 1 then set object_file = object_file_system.CreateTextFile(firefox_folder & "\" & firefox_corrupted_file_1 & ".temporary", TRUE, FALSE) ' (TRUE = Écraser si existe déjà) (FALSE = Utiliser ASCII au lieu d'Unicode UTF16LE donc pas de Byte Order Mark FFFE) object_file.Close if object_file_system.FileExists(firefox_folder & "\" & firefox_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & firefox_folder & "\" & firefox_corrupted_file_1 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if set object_file = object_file_system.CreateTextFile(firefox_folder & "\" & firefox_corrupted_file_2 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(firefox_folder & "\" & firefox_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & firefox_folder & "\" & firefox_corrupted_file_2 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 2 OR i_installation_type = 5 then set object_file = object_file_system.CreateTextFile(firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if set object_file = object_file_system.CreateTextFile(firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 3 OR i_installation_type = 5 then set object_file = object_file_system.CreateTextFile(firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if set object_file = object_file_system.CreateTextFile(firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 6 then set object_file = object_file_system.CreateTextFile(firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if set object_file = object_file_system.CreateTextFile(firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 7 then set object_file = object_file_system.CreateTextFile(firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if set object_file = object_file_system.CreateTextFile(firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if end if function i_my_replace_array_hex_strings_in_file(byval array_hex_strings_to_find, byval array_hex_strings_to_replace, byval file_fullname) set object_file_input = object_file_system.OpenTextFile(file_fullname, 1) ' Ouverture du fichier en lecture set object_file_output = object_file_system.OpenTextFile(file_fullname & ".temporary", 2, TRUE, 0) ' Ouverture du fichier en écriture (TRUE = Fichier créé si n'existe pas) (0 = ASCII, -1 = Unicode, -2 = Par défaut) char_buffer = "" i_char_check = 0 b_replacement_done = FALSE i_replacement_count = 0 i_1 = 0 do until object_file_input.AtEndOfStream character_read = object_file_input.Read(1) ' byte_read = ucase(cstr(hex(ascb(character_read)))) ' byte_read = string(2 - len(byte_read), "0") & byte_read ' WScript.Echo "Caractère lu (code " & byte_read & ") : " & character_read if b_replacement_done = FALSE then ' Pour aller plus vite, extraction des 5 premiers octets et conversion en caractères byte_to_find_1 = mid(array_hex_strings_to_find(i_1),1,2) byte_to_find_2 = mid(array_hex_strings_to_find(i_1),3,2) byte_to_find_3 = mid(array_hex_strings_to_find(i_1),5,2) byte_to_find_4 = mid(array_hex_strings_to_find(i_1),7,2) byte_to_find_5 = mid(array_hex_strings_to_find(i_1),9,2) char_to_find_1 = chr(cdbl("&h" & byte_to_find_1)) char_to_find_2 = chr(cdbl("&h" & byte_to_find_2)) char_to_find_3 = chr(cdbl("&h" & byte_to_find_3)) char_to_find_4 = chr(cdbl("&h" & byte_to_find_4)) char_to_find_5 = chr(cdbl("&h" & byte_to_find_5)) b_replacement_done = TRUE end if Select Case i_char_check Case 0 if character_read = char_to_find_1 then char_buffer = char_buffer & character_read i_char_check = 1 end if Case 1 if character_read = char_to_find_2 then char_buffer = char_buffer & character_read i_char_check = 2 else object_file_output.Write(char_buffer) char_buffer = "" i_char_check = 0 end if Case 2 if character_read = char_to_find_3 then char_buffer = char_buffer & character_read i_char_check = 3 else object_file_output.Write(char_buffer) char_buffer = "" i_char_check = 0 end if Case 3 if character_read = char_to_find_4 then char_buffer = char_buffer & character_read i_char_check = 4 else object_file_output.Write(char_buffer) char_buffer = "" i_char_check = 0 end if Case 4 if character_read = char_to_find_5 then char_buffer = char_buffer & character_read i_char_check = 5 else object_file_output.Write(char_buffer) char_buffer = "" i_char_check = 0 end if Case Else if character_read = chr(cdbl("&h" & mid(array_hex_strings_to_find(i_1),2*i_char_check+1,2))) then char_buffer = char_buffer & character_read i_char_check = i_char_check + 1 else object_file_output.Write(char_buffer) char_buffer = "" i_char_check = 0 end if if i_char_check = len(array_hex_strings_to_find(i_1)) / 2 then for i_2 = 1 to len(array_hex_strings_to_replace(i_1)) step 2 object_file_output.Write(chr(cdbl("&h" & mid(array_hex_strings_to_replace(i_1),i_2,2)))) next char_buffer = "" i_char_check = 0 b_replacement_done = FALSE i_replacement_count = i_replacement_count + 1 WScript.Echo "Fichier :" & vbCrLf & file_fullname & vbCrLf & "Séquence trouvée :" & vbCrLf & array_hex_strings_to_find(i_1) & vbCrLf & "Remplacée par :" & vbCrLf & array_hex_strings_to_replace(i_1) & vbCrLf if i_1 < ubound(array_hex_strings_to_find) then i_1 = i_1 + 1 end if end if End Select if i_char_check = 0 AND b_replacement_done = TRUE then object_file_output.Write(character_read) end if loop object_file_input.Close object_file_output.Close i_my_replace_array_hex_strings_in_file = i_replacement_count end function if i_installation_type = 1 then number_of_replacements_1 = i_my_replace_array_hex_strings_in_file(firefox_corrupted_file_1_error_ori, firefox_corrupted_file_1_error_fix, firefox_folder & "\" & firefox_corrupted_file_1) Wscript.Echo number_of_replacements_1 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & firefox_folder & "\" & firefox_corrupted_file_1 & vbCrLf number_of_replacements_2 = i_my_replace_array_hex_strings_in_file(firefox_corrupted_file_2_error_ori, firefox_corrupted_file_2_error_fix, firefox_folder & "\" & firefox_corrupted_file_2) Wscript.Echo number_of_replacements_2 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & firefox_folder & "\" & firefox_corrupted_file_2 & vbCrLf end if if i_installation_type = 2 OR i_installation_type = 5 then number_of_replacements_1 = i_my_replace_array_hex_strings_in_file(firefox_corrupted_file_1_error_ori, firefox_corrupted_file_1_error_fix, firefox_folder_portable_32 & "\" & firefox_corrupted_file_1) Wscript.Echo number_of_replacements_1 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 & vbCrLf number_of_replacements_2 = i_my_replace_array_hex_strings_in_file(firefox_corrupted_file_2_error_ori, firefox_corrupted_file_2_error_fix, firefox_folder_portable_32 & "\" & firefox_corrupted_file_2) Wscript.Echo number_of_replacements_2 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 & vbCrLf end if if i_installation_type = 3 OR i_installation_type = 5 then number_of_replacements_1 = i_my_replace_array_hex_strings_in_file(firefox_corrupted_file_1_error_ori, firefox_corrupted_file_1_error_fix, firefox_folder_portable_64 & "\" & firefox_corrupted_file_1) Wscript.Echo number_of_replacements_1 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 & vbCrLf number_of_replacements_2 = i_my_replace_array_hex_strings_in_file(firefox_corrupted_file_2_error_ori, firefox_corrupted_file_2_error_fix, firefox_folder_portable_64 & "\" & firefox_corrupted_file_2) Wscript.Echo number_of_replacements_2 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 & vbCrLf end if if i_installation_type = 6 then number_of_replacements_1 = i_my_replace_array_hex_strings_in_file(firefox_corrupted_file_1_error_ori, firefox_corrupted_file_1_error_fix, firefox_folder_installed_32 & "\" & firefox_corrupted_file_1) Wscript.Echo number_of_replacements_1 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 & vbCrLf number_of_replacements_2 = i_my_replace_array_hex_strings_in_file(firefox_corrupted_file_2_error_ori, firefox_corrupted_file_2_error_fix, firefox_folder_installed_32 & "\" & firefox_corrupted_file_2) Wscript.Echo number_of_replacements_2 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 & vbCrLf end if if i_installation_type = 7 then number_of_replacements_1 = i_my_replace_array_hex_strings_in_file(firefox_corrupted_file_1_error_ori, firefox_corrupted_file_1_error_fix, firefox_folder_installed_64 & "\" & firefox_corrupted_file_1) Wscript.Echo number_of_replacements_1 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 & vbCrLf number_of_replacements_2 = i_my_replace_array_hex_strings_in_file(firefox_corrupted_file_2_error_ori, firefox_corrupted_file_2_error_fix, firefox_folder_installed_64 & "\" & firefox_corrupted_file_2) Wscript.Echo number_of_replacements_2 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 & vbCrLf end if Function i_my_rename_file(byval file_fullname, byval file_fullname_new) if not object_file_system.FileExists(file_fullname) then WScript.Echo "Erreur, le fichier :" & vbCrLf & file_fullname & vbCrLf & "n'existe pas, impossible de le renommer en :" & vbCrLf & file_fullname_new WScript.Sleep 5000 WScript.Quit(0) end if ' WScript.Echo "On renomme le fichier :" & vbCrLf & file_fullname & vbCrLf & "en :" & vbCrLf & file_fullname_new object_file_system.MoveFile file_fullname, file_fullname_new if not object_file_system.FileExists(file_fullname_new) then WScript.Echo "Erreur, le fichier :" & vbCrLf & file_fullname & vbCrLf & "n'a pas pu être renommé." WScript.Sleep 5000 WScript.Quit(0) end if i_my_rename_file = 0 end function if i_installation_type = 1 then i_my_rename_file firefox_folder & "\" & firefox_corrupted_file_1, firefox_folder & "\" & firefox_corrupted_file_1 & ".bak" i_my_rename_file firefox_folder & "\" & firefox_corrupted_file_1 & ".temporary", firefox_folder & "\" & firefox_corrupted_file_1 i_my_rename_file firefox_folder & "\" & firefox_corrupted_file_2, firefox_folder & "\" & firefox_corrupted_file_2 & ".bak" i_my_rename_file firefox_folder & "\" & firefox_corrupted_file_2 & ".temporary", firefox_folder & "\" & firefox_corrupted_file_2 end if if i_installation_type = 2 OR i_installation_type = 5 then i_my_rename_file firefox_folder_portable_32 & "\" & firefox_corrupted_file_1, firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 & ".bak" i_my_rename_file firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 & ".temporary", firefox_folder_portable_32 & "\" & firefox_corrupted_file_1 i_my_rename_file firefox_folder_portable_32 & "\" & firefox_corrupted_file_2, firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 & ".bak" i_my_rename_file firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 & ".temporary", firefox_folder_portable_32 & "\" & firefox_corrupted_file_2 end if if i_installation_type = 3 OR i_installation_type = 5 then i_my_rename_file firefox_folder_portable_64 & "\" & firefox_corrupted_file_1, firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 & ".bak" i_my_rename_file firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 & ".temporary", firefox_folder_portable_64 & "\" & firefox_corrupted_file_1 i_my_rename_file firefox_folder_portable_64 & "\" & firefox_corrupted_file_2, firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 & ".bak" i_my_rename_file firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 & ".temporary", firefox_folder_portable_64 & "\" & firefox_corrupted_file_2 end if if i_installation_type = 6 then i_my_rename_file firefox_folder_installed_32 & "\" & firefox_corrupted_file_1, firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 & ".bak" i_my_rename_file firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 & ".temporary", firefox_folder_installed_32 & "\" & firefox_corrupted_file_1 i_my_rename_file firefox_folder_installed_32 & "\" & firefox_corrupted_file_2, firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 & ".bak" i_my_rename_file firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 & ".temporary", firefox_folder_installed_32 & "\" & firefox_corrupted_file_2 end if if i_installation_type = 7 then i_my_rename_file firefox_folder_installed_64 & "\" & firefox_corrupted_file_1, firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 & ".bak" i_my_rename_file firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 & ".temporary", firefox_folder_installed_64 & "\" & firefox_corrupted_file_1 i_my_rename_file firefox_folder_installed_64 & "\" & firefox_corrupted_file_2, firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 & ".bak" i_my_rename_file firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 & ".temporary", firefox_folder_installed_64 & "\" & firefox_corrupted_file_2 end if WScript.Sleep 5000 WScript.Quit(0) Il faudra donner au fichier ".txt" l'extension ".vbs". PS : Je remercie ChatGPT pour la vitesse à laquelle j'ai pu écrire ces scripts. Pour les puristes, je sais, il eut été plus intelligent de faire d'abord une fonction de recherche, puis ensuite une fonction d'édition en utilisant une fonction type "fsetpos", mais j'avais la flemme, j'ai torché ça à l'arrache en 2h en dehors du taf sur mon temps de pause, donc soyez indulgents.
  8. Code pour Thunderbird : Sur le bureau de Windows, créez un nouveau document texte (extension ".txt"). Si vous n'avez pas démasqué les extensions de Windows, (bon déjà vous méritez de mourir, ensuite) regardez sur Internet comment faire, je vais pas tout expliquer non plus. Ouvrez-le, puis allez dans Fichier > Enregistrer sous... et dans "Encodage" mettez "UTF-16 LE" ("Unicode" sous Windows 7). Ensuite, copié-collez le code en Powershsell ci-dessous dans le fichier. # Character encoding = UTF-16 LE (Byte Order Mark = FF FE) # End-of-line = Windows (CR LF) # Composants requis : $current_folder = $PWD.Path # Emplacement personnalisé du dossier contenant le fichier "thunderbird.exe". # Vous pouvez le laisser vide. Exemple : # $thunderbird_folder = "$current_folder\Mozilla Thunderbird" $thunderbird_folder = "" # Emplacements connus : $thunderbird_folder_portable_32 = "$current_folder\App\Thunderbird" $thunderbird_folder_portable_64 = "$current_folder\App\Thunderbird64" $thunderbird_folder_installed_32 = "${env:ProgramFiles(x86)}\Mozilla Thunderbird" $thunderbird_folder_installed_64 = "${$env:ProgramFiles}\Mozilla Thunderbird" # Fichiers à réparer : $thunderbird_corrupted_file_1 = "omni.ja" # Réparations à faire : $thunderbird_corrupted_file_1_error_ori = @() $thunderbird_corrupted_file_1_error_fix = @() $thunderbird_corrupted_file_1_error_ori += "7574696C69736174657572C2B774726963650A" $thunderbird_corrupted_file_1_error_fix += "7574696C697361746575720A0A0A0A0A0A0A0A" # utilisateur·trice => utilisateur $thunderbird_corrupted_file_1_error_ori += "4A65616EC2B76E65204475706F6E740A" $thunderbird_corrupted_file_1_error_fix += "4A65616E204475706F6E740A0A0A0A0A" # Jean·ne Dupont => Jean Dupont $thunderbird_corrupted_file_1_error_ori += "6A65616E2E6E652E6475706F6E74406578616D706C652E636F6D0A" $thunderbird_corrupted_file_1_error_fix += "6A65616E2E6475706F6E74406578616D706C652E636F6D0A0A0A0A" # jean.ne.dupont@example.com => jean.dupont@example.com $thunderbird_corrupted_file_1_error_ori += "617665727469C2B765206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A" $thunderbird_corrupted_file_1_error_fix += "617665727469206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A0A0A0A" # averti·e lorsque la génération de clé sera terminée. => averti lorsque la génération de clé sera terminée. $thunderbird_corrupted_file_1_error_ori += "617665727469C2B765206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A" $thunderbird_corrupted_file_1_error_fix += "617665727469206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A0A0A0A" # averti·e lorsque la génération de clé sera terminée. => averti lorsque la génération de clé sera terminée. $thunderbird_corrupted_file_1_error_ori += "736174697366616974C2B7652064752072C3A973756C7461742E0A" $thunderbird_corrupted_file_1_error_fix += "7361746973666169742064752072C3A973756C7461742E0A0A0A0A" # satisfait·e du résultat. => satisfait du résultat. $thunderbird_corrupted_file_1_error_ori += "636F6E6E656374C3A9C2B76520706C7573696575727320666F69732C20756E652061757472652073657373696F6E20706575742061766F6972207265C3A775206C65206D6573736167652E0A" $thunderbird_corrupted_file_1_error_fix += "636F6E6E656374C3A920706C7573696575727320666F69732C20756E652061757472652073657373696F6E20706575742061766F6972207265C3A775206C65206D6573736167652E0A0A0A0A" # connecté·e plusieurs fois, une autre session peut avoir reçu le message. => connecté plusieurs fois, une autre session peut avoir reçu le message. $thunderbird_corrupted_file_1_error_ori += "70697374C3A9C2B7650A" $thunderbird_corrupted_file_1_error_fix += "70697374C3A90A0A0A0A" # pisté·e => pisté $i_installation_type = 0 if ($thunderbird_folder -ne "") { if (-not (Test-Path "$thunderbird_folder\$thunderbird_corrupted_file_1")) { Write-Host "Erreur, fichier non détecté :`r`n$thunderbird_folder\$thunderbird_corrupted_file_1" Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } $i_installation_type = 1 Write-Host "Fichier détecté :`r`n$thunderbird_folder\$thunderbird_corrupted_file_1`r`n" } if (Test-Path "$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1") { $i_installation_type = 2 Write-Host "Fichier détecté :`r`n$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1`r`n" } if (Test-Path "$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1") { $i_installation_type += 3 Write-Host "Fichier détecté :`r`n$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1`r`n" } if (Test-Path "$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1") { $i_installation_type = 6 Write-Host "Fichier détecté :`r`n$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1`r`n" } if (Test-Path "$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1") { $i_installation_type = 7 Write-Host "Fichier détecté :`r`n$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1`r`n" } if ($i_installation_type -eq 0) { Write-Host "Erreur, aucun fichier détecté." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if ($i_installation_type -eq 1) { if (Test-Path -Path "$thunderbird_folder\$thunderbird_corrupted_file_1.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$thunderbird_folder\$thunderbird_corrupted_file_1.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 2 -or $i_installation_type -eq 5) { if (Test-Path -Path "$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 3 -or $i_installation_type -eq 5) { if (Test-Path -Path "$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 6) { if (Test-Path -Path "$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 7) { if (Test-Path -Path "$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1.bak") { Write-Host "Erreur, le fichier de sauvegarde :`r`n$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1.bak" "existe déjà. Si vous avez déjà utilisé ce script mais que`r`nl'écriture inclusive est revenue à la suite d'une mise à jour," "supprimez le fichier "".bak"" et relancez ce script." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($thunderbird_corrupted_file_1_error_ori.Length -ne $thunderbird_corrupted_file_1_error_fix.Length) { Write-Host "Erreur :`r`nLe nombre de cases dans le tableau des chaînes hexadécimales à détecter`r`net dans le tableau des chaînes hexadécimales à remplacer n'est pas identique." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } for ($i = 0; $i -le $thunderbird_corrupted_file_1_error_ori.Length - 1; $i += 1) { # Write-Host $($thunderbird_corrupted_file_1_error_ori[$i]) = $($thunderbird_corrupted_file_1_error_ori[$i].Length)`r`n$($thunderbird_corrupted_file_1_error_fix[$i]) = $($thunderbird_corrupted_file_1_error_fix[$i].Length) if ($thunderbird_corrupted_file_1_error_ori[$i].Length -ne $thunderbird_corrupted_file_1_error_fix[$i].Length) { Write-Host "Erreur :`r`nLa variable ""$($thunderbird_corrupted_file_1_error_ori[$i])"" et`r`nla variable ""$($thunderbird_corrupted_file_1_error_fix[$i])""" "n'ont pas le même nombre de caractères." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if ($thunderbird_corrupted_file_1_error_ori[$i].Length % 2 -ne 0) { Write-Host "Erreur, les variables :`r`n$($thunderbird_corrupted_file_1_error_ori[$i])`r`n$($thunderbird_corrupted_file_1_error_fix[$i])`r`nont un nombre impair de caractères." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } if ($thunderbird_corrupted_file_1_error_ori[$i].Length -lt 12) { Write-Host "Erreur, les variables :`r`n$($thunderbird_corrupted_file_1_error_ori[$i])`r`n$($thunderbird_corrupted_file_1_error_fix[$i])`r`ndoivent avoir au moins 12 caractères hexadécimaux" ` "`r`npour représenter au moins 6 octets.`r`nOr ici, elles n'en contiennent que $($thunderbird_corrupted_file_1_error_ori[$i].Length)." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 1) { Out-File -FilePath "$thunderbird_folder\$thunderbird_corrupted_file_1.temporary" -Force -Encoding ASCII # (Force = Écraser si existe déjà) (Encoding ASCII = Utiliser ASCII au lieu d'Unicode UTF16LE donc pas de Byte Order Mark FFFE) if (-not (Test-Path "$thunderbird_folder\$thunderbird_corrupted_file_1.temporary")) { Write-Host "Erreur, le fichier :`r`n$thunderbird_folder\$thunderbird_corrupted_file_1.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 2 -or $i_installation_type -eq 5) { Out-File -FilePath "$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1.temporary" -Force -Encoding ASCII if (-not (Test-Path "$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1.temporary")) { Write-Host "Erreur, le fichier :`r`n$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 3 -or $i_installation_type -eq 5) { Out-File -FilePath "$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1.temporary" -Force -Encoding ASCII if (-not (Test-Path "$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1.temporary")) { Write-Host "Erreur, le fichier :`r`n$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 6) { Out-File -FilePath "$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1.temporary" -Force -Encoding ASCII if (-not (Test-Path "$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1.temporary")) { Write-Host "Erreur, le fichier :`r`n$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } if ($i_installation_type -eq 7) { Out-File -FilePath "$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1.temporary" -Force -Encoding ASCII if (-not (Test-Path "$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1.temporary")) { Write-Host "Erreur, le fichier :`r`n$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1.temporary" "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement`r`ndes privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } } function i_my_replace_array_hex_strings_in_file([string[]]$array_hex_strings_to_find, [string[]]$array_hex_strings_to_replace, [string]$file_fullname) { $file_input = [System.IO.File]::OpenRead($file_fullname) # Ouverture du fichier en lecture $file_output = [System.IO.File]::Create("$file_fullname.temporary") # Ouverture du fichier en écriture $byte_buffer_read = New-Object byte[] 1 $byte_buffer = New-Object byte[] 0 $i_byte_check = 0 $b_replacement_done = $false $i_replacement_count = 0 $i_1 = 0 while ($file_input.Read($byte_buffer_read, 0, 1) -ne 0) { $byte_read = $byte_buffer_read[0] # $character_read = [char]$byte_read # Write-Host "Caractère lu (code $($byte_read.ToString("X2"))) : $character_read" if ($b_replacement_done -eq $false) { # Pour aller plus vite, extraction des 5 premiers octets et conversion en décimal $byte_to_find_1 = [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(0, 2), 16) $byte_to_find_2 = [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(2, 2), 16) $byte_to_find_3 = [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(4, 2), 16) $byte_to_find_4 = [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(6, 2), 16) $byte_to_find_5 = [Convert]::ToInt32($array_hex_strings_to_find[$i_1].Substring(8, 2), 16) $b_replacement_done = $true } switch ($i_byte_check) { 0 { if ($byte_read -eq $byte_to_find_1) { $byte_buffer += $byte_read $i_byte_check = 1 } break } 1 { if ($byte_read -eq $byte_to_find_2) { $byte_buffer += $byte_read $i_byte_check = 2 } else { $file_output.Write($byte_buffer, 0, $byte_buffer.Length) $byte_buffer = @() $i_byte_check = 0 } break } 2 { if ($byte_read -eq $byte_to_find_3) { $byte_buffer += $byte_read $i_byte_check = 3 } else { $file_output.Write($byte_buffer, 0, $byte_buffer.Length) $byte_buffer = @() $i_byte_check = 0 } break } 3 { if ($byte_read -eq $byte_to_find_4) { $byte_buffer += $byte_read $i_byte_check = 4 } else { $file_output.Write($byte_buffer, 0, $byte_buffer.Length) $byte_buffer = @() $i_byte_check = 0 } break } 4 { if ($byte_read -eq $byte_to_find_5) { $byte_buffer += $byte_read $i_byte_check = 5 } else { $file_output.Write($byte_buffer, 0, $byte_buffer.Length) $byte_buffer = @() $i_byte_check = 0 } break } default { if ($byte_read.ToString("X2") -eq $array_hex_strings_to_find[$i_1].Substring(2 * $i_byte_check, 2)) { $byte_buffer += $byte_read $i_byte_check++ } else { $file_output.Write($byte_buffer, 0, $byte_buffer.Length) $byte_buffer = @() $i_byte_check = 0 } if ($i_byte_check -eq $array_hex_strings_to_find[$i_1].Length / 2) { for ($i_2 = 0; $i_2 -lt $array_hex_strings_to_replace[$i_1].Length; $i_2 += 2) { $file_output.WriteByte([byte]::Parse($array_hex_strings_to_replace[$i_1].Substring($i_2, 2), [System.Globalization.NumberStyles]::HexNumber)) } $byte_buffer = @() $i_byte_check = 0 $b_replacement_done = $false $i_replacement_count++ Write-Host "Fichier :`r`n$file_fullname`r`nSéquence trouvée :`r`n$($array_hex_strings_to_find[$i_1])`r`nRemplacée par :`r`n$($array_hex_strings_to_replace[$i_1])`r`n" if ($i_1 -lt $array_hex_strings_to_find.Length - 1) { $i_1++ } } } } if ($i_byte_check -eq 0 -and $b_replacement_done -eq $true) { $file_output.WriteByte($byte_read) } } $file_input.Close() $file_output.Close() $file_input.Dispose() $file_output.Dispose() return $i_replacement_count } if ($i_installation_type -eq 1) { $number_of_replacements_1 = i_my_replace_array_hex_strings_in_file $thunderbird_corrupted_file_1_error_ori $thunderbird_corrupted_file_1_error_fix ("$thunderbird_folder\$thunderbird_corrupted_file_1") Write-Host "$number_of_replacements_1 remplacement(s) effectué(s) sur le fichier :`r`n$thunderbird_folder\$thunderbird_corrupted_file_1`r`n" } if ($i_installation_type -eq 2 -or $i_installation_type -eq 5) { $number_of_replacements_1 = i_my_replace_array_hex_strings_in_file $thunderbird_corrupted_file_1_error_ori $thunderbird_corrupted_file_1_error_fix ("$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1") Write-Host "$number_of_replacements_1 remplacement(s) effectué(s) sur le fichier :`r`n$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1`r`n" } if ($i_installation_type -eq 3 -or $i_installation_type -eq 5) { $number_of_replacements_1 = i_my_replace_array_hex_strings_in_file $thunderbird_corrupted_file_1_error_ori $thunderbird_corrupted_file_1_error_fix ("$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1") Write-Host "$number_of_replacements_1 remplacement(s) effectué(s) sur le fichier :`r`n$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1`r`n" } if ($i_installation_type -eq 6) { $number_of_replacements_1 = i_my_replace_array_hex_strings_in_file $thunderbird_corrupted_file_1_error_ori $thunderbird_corrupted_file_1_error_fix ("$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1") Write-Host "$number_of_replacements_1 remplacement(s) effectué(s) sur le fichier :`r`n$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1`r`n" } if ($i_installation_type -eq 7) { $number_of_replacements_1 = i_my_replace_array_hex_strings_in_file $thunderbird_corrupted_file_1_error_ori $thunderbird_corrupted_file_1_error_fix ("$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1") Write-Host "$number_of_replacements_1 remplacement(s) effectué(s) sur le fichier :`r`n$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1`r`n" } function i_my_rename_file([string]$file_fullname, [string]$file_fullname_new) { if (-not (Test-Path $file_fullname)) { Write-Host "Erreur, le fichier :`r`n$file_fullname`r`nn'existe pas, impossible de le renommer en :`r`n$file_fullname_new" Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } # Write-Host "On renomme le fichier :`r`n$file_fullname`r`nen :`r`n$file_fullname_new" Rename-Item -Path $file_fullname -NewName $file_fullname_new -ErrorAction Stop if (-not (Test-Path $file_fullname_new)) { Write-Host "Erreur, le fichier :`r`n$file_fullname`r`nn'a pas pu être renommé." Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 } return 0 } if ($i_installation_type -eq 1) { $i_return = i_my_rename_file "$thunderbird_folder\$thunderbird_corrupted_file_1" "$thunderbird_folder\$thunderbird_corrupted_file_1.bak" $i_return = i_my_rename_file "$thunderbird_folder\$thunderbird_corrupted_file_1.temporary" "$thunderbird_folder\$thunderbird_corrupted_file_1" } if ($i_installation_type -eq 2 -or $i_installation_type -eq 5) { $i_return = i_my_rename_file "$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1" "$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1.bak" $i_return = i_my_rename_file "$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1.temporary" "$thunderbird_folder_portable_32\$thunderbird_corrupted_file_1" } if ($i_installation_type -eq 3 -or $i_installation_type -eq 5) { $i_return = i_my_rename_file "$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1" "$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1.bak" $i_return = i_my_rename_file "$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1.temporary" "$thunderbird_folder_portable_64\$thunderbird_corrupted_file_1" } if ($i_installation_type -eq 6) { $i_return = i_my_rename_file "$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1" "$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1.bak" $i_return = i_my_rename_file "$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1.temporary" "$thunderbird_folder_installed_32\$thunderbird_corrupted_file_1" } if ($i_installation_type -eq 7) { $i_return = i_my_rename_file "$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1" "$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1.bak" $i_return = i_my_rename_file "$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1.temporary" "$thunderbird_folder_installed_64\$thunderbird_corrupted_file_1" } Write-Host "`r`nAppuyez sur une touche pour continuer..." $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit 0 Enregistrez et fermez le fichier, puis changez son extension ".txt" en ".ps1". Si vous avez Thunderbird Portable, vous pouvez renommer le fichier en "ThunderbirdPortable - Supprimer écriture inclusive.ps1" par exemple. Ensuite il faut placer le fichier script dans le dossier racine, par exemple : "D:\Programs\PortableApps\PortableApps\ThunderbirdPortable". Si vous avez installé Thunderbird, vous pouvez mettre ce fichier depuis n'importe où. Pour une autre installation, il vous suffit de modifier le début du script pour renseigner l'emplacement. Ensuite double-cliquez dessus pour nettoyer les fichiers corrompus. Bonus : voici une version du script en VisualBasic Script (exécutable en mode fenêtre ou en mode console). C'est plus lent mais si vous n'arrivez pas à utiliser le PowerShell, ça fonctionnera aussi : ' Character encoding = UTF-16 LE (Byte Order Mark = FF FE) ' End-of-line = Windows (CR LF) ' Composants requis : set object_shell = WScript.CreateObject("WScript.Shell") set object_file_system = WScript.CreateObject("Scripting.FileSystemObject") current_folder = object_file_system.GetParentFolderName(WScript.ScriptFullName) ' Emplacement personnalisé du dossier contenant le fichier "thunderbird.exe". ' Vous pouvez le laisser vide. Exemple : ' thunderbird_folder = current_folder & "\Mozilla Thunderbird" thunderbird_folder = "" ' Emplacements connus : thunderbird_folder_portable_32 = current_folder & "\App\Thunderbird" thunderbird_folder_portable_64 = current_folder & "\App\Thunderbird64" thunderbird_folder_installed_32 = object_shell.ExpandEnvironmentStrings("%ProgramFiles(x86)%") & "\Mozilla Thunderbird" thunderbird_folder_installed_64 = object_shell.ExpandEnvironmentStrings("%ProgramFiles%") & "\Mozilla Thunderbird" ' Fichiers à réparer : thunderbird_corrupted_file_1 = "omni.ja" ' Réparations à faire : dim thunderbird_corrupted_file_1_error_ori() dim thunderbird_corrupted_file_1_error_fix() redim preserve thunderbird_corrupted_file_1_error_ori(0) redim preserve thunderbird_corrupted_file_1_error_fix(0) thunderbird_corrupted_file_1_error_ori(0) = "7574696C69736174657572C2B774726963650A" thunderbird_corrupted_file_1_error_fix(0) = "7574696C697361746575720A0A0A0A0A0A0A0A" ' utilisateur·trice => utilisateur redim preserve thunderbird_corrupted_file_1_error_ori(ubound(thunderbird_corrupted_file_1_error_ori) + 1) redim preserve thunderbird_corrupted_file_1_error_fix(ubound(thunderbird_corrupted_file_1_error_fix) + 1) thunderbird_corrupted_file_1_error_ori(1) = "4A65616EC2B76E65204475706F6E740A" thunderbird_corrupted_file_1_error_fix(1) = "4A65616E204475706F6E740A0A0A0A0A" ' Jean·ne Dupont => Jean Dupont redim preserve thunderbird_corrupted_file_1_error_ori(ubound(thunderbird_corrupted_file_1_error_ori) + 1) redim preserve thunderbird_corrupted_file_1_error_fix(ubound(thunderbird_corrupted_file_1_error_fix) + 1) thunderbird_corrupted_file_1_error_ori(2) = "6A65616E2E6E652E6475706F6E74406578616D706C652E636F6D0A" thunderbird_corrupted_file_1_error_fix(2) = "6A65616E2E6475706F6E74406578616D706C652E636F6D0A0A0A0A" ' jean.ne.dupont@example.com => jean.dupont@example.com redim preserve thunderbird_corrupted_file_1_error_ori(ubound(thunderbird_corrupted_file_1_error_ori) + 1) redim preserve thunderbird_corrupted_file_1_error_fix(ubound(thunderbird_corrupted_file_1_error_fix) + 1) thunderbird_corrupted_file_1_error_ori(3) = "617665727469C2B765206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A" thunderbird_corrupted_file_1_error_fix(3) = "617665727469206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A0A0A0A" ' averti·e lorsque la génération de clé sera terminée. => averti lorsque la génération de clé sera terminée. redim preserve thunderbird_corrupted_file_1_error_ori(ubound(thunderbird_corrupted_file_1_error_ori) + 1) redim preserve thunderbird_corrupted_file_1_error_fix(ubound(thunderbird_corrupted_file_1_error_fix) + 1) thunderbird_corrupted_file_1_error_ori(4) = "617665727469C2B765206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A" thunderbird_corrupted_file_1_error_fix(4) = "617665727469206C6F7273717565206C612067C3A96EC3A9726174696F6E20646520636CC3A92073657261207465726D696EC3A9652E0A0A0A0A" ' averti·e lorsque la génération de clé sera terminée. => averti lorsque la génération de clé sera terminée. redim preserve thunderbird_corrupted_file_1_error_ori(ubound(thunderbird_corrupted_file_1_error_ori) + 1) redim preserve thunderbird_corrupted_file_1_error_fix(ubound(thunderbird_corrupted_file_1_error_fix) + 1) thunderbird_corrupted_file_1_error_ori(5) = "736174697366616974C2B7652064752072C3A973756C7461742E0A" thunderbird_corrupted_file_1_error_fix(5) = "7361746973666169742064752072C3A973756C7461742E0A0A0A0A" ' satisfait·e du résultat. => satisfait du résultat. redim preserve thunderbird_corrupted_file_1_error_ori(ubound(thunderbird_corrupted_file_1_error_ori) + 1) redim preserve thunderbird_corrupted_file_1_error_fix(ubound(thunderbird_corrupted_file_1_error_fix) + 1) thunderbird_corrupted_file_1_error_ori(6) = "636F6E6E656374C3A9C2B76520706C7573696575727320666F69732C20756E652061757472652073657373696F6E20706575742061766F6972207265C3A775206C65206D6573736167652E0A" thunderbird_corrupted_file_1_error_fix(6) = "636F6E6E656374C3A920706C7573696575727320666F69732C20756E652061757472652073657373696F6E20706575742061766F6972207265C3A775206C65206D6573736167652E0A0A0A0A" ' connecté·e plusieurs fois, une autre session peut avoir reçu le message. => connecté plusieurs fois, une autre session peut avoir reçu le message. redim preserve thunderbird_corrupted_file_1_error_ori(ubound(thunderbird_corrupted_file_1_error_ori) + 1) redim preserve thunderbird_corrupted_file_1_error_fix(ubound(thunderbird_corrupted_file_1_error_fix) + 1) thunderbird_corrupted_file_1_error_ori(7) = "70697374C3A9C2B7650A" thunderbird_corrupted_file_1_error_fix(7) = "70697374C3A90A0A0A0A" ' pisté·e => pisté i_installation_type = 0 if thunderbird_folder <> "" then if object_file_system.FileExists(thunderbird_folder & "\" & thunderbird_corrupted_file_1) = FALSE then WScript.Echo "Erreur, fichier non détecté :" & vbCrLf & thunderbird_folder & "\" & thunderbird_corrupted_file_1 WScript.Sleep 5000 WScript.Quit(0) end if i_installation_type = 1 WScript.Echo "Fichier détecté :" & vbCrLf & thunderbird_folder & "\" & thunderbird_corrupted_file_1 & vbCrLf end if if object_file_system.FileExists(thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1) = TRUE then i_installation_type = 2 WScript.Echo "Fichier détecté :" & vbCrLf & thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1 & vbCrLf end if if object_file_system.FileExists(thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1) = TRUE then i_installation_type = i_installation_type + 3 WScript.Echo "Fichier détecté :" & vbCrLf & thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1 & vbCrLf end if if object_file_system.FileExists(thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1) = TRUE then i_installation_type = 6 WScript.Echo "Fichier détecté :" & vbCrLf & thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1 & vbCrLf end if if object_file_system.FileExists(thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1) = TRUE then i_installation_type = 7 WScript.Echo "Fichier détecté :" & vbCrLf & thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1 & vbCrLf end if if i_installation_type = 0 then WScript.Echo "Erreur, aucun fichier détecté." WScript.Sleep 5000 WScript.Quit(0) end if if i_installation_type = 1 then if object_file_system.FileExists(thunderbird_folder & "\" & thunderbird_corrupted_file_1 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & thunderbird_folder & "\" & thunderbird_corrupted_file_1 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 2 OR i_installation_type = 5 then if object_file_system.FileExists(thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 3 OR i_installation_type = 5 then if object_file_system.FileExists(thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 6 then if object_file_system.FileExists(thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 7 then if object_file_system.FileExists(thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1 & ".bak") = TRUE then WScript.Echo "Erreur, le fichier de sauvegarde :" & vbCrLf & thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1 & ".bak" & vbCrLf _ & "existe déjà. Si vous avez déjà utilisé ce script mais que" & vbCrLf & "l'écriture inclusive est revenue à la suite d'une mise à jour," & vbCrLf _ & "supprimez le fichier "".bak"" et relancez ce script." WScript.Sleep 5000 WScript.Quit(0) end if end if if ubound(thunderbird_corrupted_file_1_error_ori) <> ubound(thunderbird_corrupted_file_1_error_fix) then WScript.Echo "Erreur :" & vbCrLf & "Le nombre de cases dans le tableau des chaînes hexadécimales à détecter" & vbCrLf & "et dans le tableau des chaînes hexadécimales à remplacer n'est pas identique." WScript.Sleep 5000 WScript.Quit(0) end if for i = 0 to ubound(thunderbird_corrupted_file_1_error_ori) step 1 ' WScript.Echo thunderbird_corrupted_file_1_error_ori(i) & " = " & len(thunderbird_corrupted_file_1_error_ori(i)) & vbCrLf & thunderbird_corrupted_file_1_error_fix(i) & " = " & len(thunderbird_corrupted_file_1_error_fix(i)) if len(thunderbird_corrupted_file_1_error_ori(i)) <> len(thunderbird_corrupted_file_1_error_fix(i)) then WScript.Echo "Erreur :" & vbCrLf & "La variable """ & thunderbird_corrupted_file_1_error_ori(i) & """ et" & vbCrLf & "la variable """ & thunderbird_corrupted_file_1_error_fix(i) & """" & vbCrLf _ & "n'ont pas le même nombre de caractères." WScript.Sleep 5000 WScript.Quit(0) end if if len(thunderbird_corrupted_file_1_error_ori(i)) MOD 2 <> 0 then WScript.Echo "Erreur, les variables :" & vbCrLf & thunderbird_corrupted_file_1_error_ori(i) & vbCrLf & thunderbird_corrupted_file_1_error_fix(i) & vbCrLf & "ont un nombre impair de caractères." WScript.Sleep 5000 WScript.Quit(0) end if if len(thunderbird_corrupted_file_1_error_ori(i)) < 12 then WScript.Echo "Erreur, les variables :" & vbCrLf & thunderbird_corrupted_file_1_error_ori(i) & vbCrLf & thunderbird_corrupted_file_1_error_fix(i) & vbCrLf & "doivent avoir au moins 12 caractères hexadécimaux" _ & vbCrLf & "pour représenter au moins 6 octets." & vbCrLf & "Or ici, elles n'en contiennent que " & len(thunderbird_corrupted_file_1_error_ori(i)) & "." WScript.Sleep 5000 WScript.Quit(0) end if next if i_installation_type = 1 then set object_file = object_file_system.CreateTextFile(thunderbird_folder & "\" & thunderbird_corrupted_file_1 & ".temporary", TRUE, FALSE) ' (TRUE = Écraser si existe déjà) (FALSE = Utiliser ASCII au lieu d'Unicode UTF16LE donc pas de Byte Order Mark FFFE) object_file.Close if object_file_system.FileExists(thunderbird_folder & "\" & thunderbird_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & thunderbird_folder & "\" & thunderbird_corrupted_file_1 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 2 OR i_installation_type = 5 then set object_file = object_file_system.CreateTextFile(thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 3 OR i_installation_type = 5 then set object_file = object_file_system.CreateTextFile(thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 6 then set object_file = object_file_system.CreateTextFile(thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if end if if i_installation_type = 7 then set object_file = object_file_system.CreateTextFile(thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1 & ".temporary", TRUE, FALSE) object_file.Close if object_file_system.FileExists(thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1 & ".temporary") = FALSE then WScript.Echo "Erreur, le fichier :" & vbCrLf & thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1 & ".temporary" & vbCrLf _ & "n'a pas pu être créé. L'écriture dans ce dossier nécessite probablement" & vbCrLf & "des privilèges d'administrateur. Veuillez exécuter ce script en tant qu'administrateur." WScript.Sleep 5000 WScript.Quit(0) end if end if function i_my_replace_array_hex_strings_in_file(byval array_hex_strings_to_find, byval array_hex_strings_to_replace, byval file_fullname) set object_file_input = object_file_system.OpenTextFile(file_fullname, 1) ' Ouverture du fichier en lecture set object_file_output = object_file_system.OpenTextFile(file_fullname & ".temporary", 2, TRUE, 0) ' Ouverture du fichier en écriture (TRUE = Fichier créé si n'existe pas) (0 = ASCII, -1 = Unicode, -2 = Par défaut) char_buffer = "" i_char_check = 0 b_replacement_done = FALSE i_replacement_count = 0 i_1 = 0 do until object_file_input.AtEndOfStream character_read = object_file_input.Read(1) ' byte_read = ucase(cstr(hex(ascb(character_read)))) ' byte_read = string(2 - len(byte_read), "0") & byte_read ' WScript.Echo "Caractère lu (code " & byte_read & ") : " & character_read if b_replacement_done = FALSE then ' Pour aller plus vite, extraction des 5 premiers octets et conversion en caractères byte_to_find_1 = mid(array_hex_strings_to_find(i_1),1,2) byte_to_find_2 = mid(array_hex_strings_to_find(i_1),3,2) byte_to_find_3 = mid(array_hex_strings_to_find(i_1),5,2) byte_to_find_4 = mid(array_hex_strings_to_find(i_1),7,2) byte_to_find_5 = mid(array_hex_strings_to_find(i_1),9,2) char_to_find_1 = chr(cdbl("&h" & byte_to_find_1)) char_to_find_2 = chr(cdbl("&h" & byte_to_find_2)) char_to_find_3 = chr(cdbl("&h" & byte_to_find_3)) char_to_find_4 = chr(cdbl("&h" & byte_to_find_4)) char_to_find_5 = chr(cdbl("&h" & byte_to_find_5)) b_replacement_done = TRUE end if Select Case i_char_check Case 0 if character_read = char_to_find_1 then char_buffer = char_buffer & character_read i_char_check = 1 end if Case 1 if character_read = char_to_find_2 then char_buffer = char_buffer & character_read i_char_check = 2 else object_file_output.Write(char_buffer) char_buffer = "" i_char_check = 0 end if Case 2 if character_read = char_to_find_3 then char_buffer = char_buffer & character_read i_char_check = 3 else object_file_output.Write(char_buffer) char_buffer = "" i_char_check = 0 end if Case 3 if character_read = char_to_find_4 then char_buffer = char_buffer & character_read i_char_check = 4 else object_file_output.Write(char_buffer) char_buffer = "" i_char_check = 0 end if Case 4 if character_read = char_to_find_5 then char_buffer = char_buffer & character_read i_char_check = 5 else object_file_output.Write(char_buffer) char_buffer = "" i_char_check = 0 end if Case Else if character_read = chr(cdbl("&h" & mid(array_hex_strings_to_find(i_1),2*i_char_check+1,2))) then char_buffer = char_buffer & character_read i_char_check = i_char_check + 1 else object_file_output.Write(char_buffer) char_buffer = "" i_char_check = 0 end if if i_char_check = len(array_hex_strings_to_find(i_1)) / 2 then for i_2 = 1 to len(array_hex_strings_to_replace(i_1)) step 2 object_file_output.Write(chr(cdbl("&h" & mid(array_hex_strings_to_replace(i_1),i_2,2)))) next char_buffer = "" i_char_check = 0 b_replacement_done = FALSE i_replacement_count = i_replacement_count + 1 WScript.Echo "Fichier :" & vbCrLf & file_fullname & vbCrLf & "Séquence trouvée :" & vbCrLf & array_hex_strings_to_find(i_1) & vbCrLf & "Remplacée par :" & vbCrLf & array_hex_strings_to_replace(i_1) & vbCrLf if i_1 < ubound(array_hex_strings_to_find) then i_1 = i_1 + 1 end if end if End Select if i_char_check = 0 AND b_replacement_done = TRUE then object_file_output.Write(character_read) end if loop object_file_input.Close object_file_output.Close i_my_replace_array_hex_strings_in_file = i_replacement_count end function if i_installation_type = 1 then number_of_replacements_1 = i_my_replace_array_hex_strings_in_file(thunderbird_corrupted_file_1_error_ori, thunderbird_corrupted_file_1_error_fix, thunderbird_folder & "\" & thunderbird_corrupted_file_1) Wscript.Echo number_of_replacements_1 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & thunderbird_folder & "\" & thunderbird_corrupted_file_1 & vbCrLf end if if i_installation_type = 2 OR i_installation_type = 5 then number_of_replacements_1 = i_my_replace_array_hex_strings_in_file(thunderbird_corrupted_file_1_error_ori, thunderbird_corrupted_file_1_error_fix, thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1) Wscript.Echo number_of_replacements_1 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1 & vbCrLf end if if i_installation_type = 3 OR i_installation_type = 5 then number_of_replacements_1 = i_my_replace_array_hex_strings_in_file(thunderbird_corrupted_file_1_error_ori, thunderbird_corrupted_file_1_error_fix, thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1) Wscript.Echo number_of_replacements_1 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1 & vbCrLf end if if i_installation_type = 6 then number_of_replacements_1 = i_my_replace_array_hex_strings_in_file(thunderbird_corrupted_file_1_error_ori, thunderbird_corrupted_file_1_error_fix, thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1) Wscript.Echo number_of_replacements_1 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1 & vbCrLf end if if i_installation_type = 7 then number_of_replacements_1 = i_my_replace_array_hex_strings_in_file(thunderbird_corrupted_file_1_error_ori, thunderbird_corrupted_file_1_error_fix, thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1) Wscript.Echo number_of_replacements_1 & " remplacement(s) effectué(s) sur le fichier :" & vbCrLf & thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1 & vbCrLf end if Function i_my_rename_file(byval file_fullname, byval file_fullname_new) if not object_file_system.FileExists(file_fullname) then WScript.Echo "Erreur, le fichier :" & vbCrLf & file_fullname & vbCrLf & "n'existe pas, impossible de le renommer en :" & vbCrLf & file_fullname_new WScript.Sleep 5000 WScript.Quit(0) end if ' WScript.Echo "On renomme le fichier :" & vbCrLf & file_fullname & vbCrLf & "en :" & vbCrLf & file_fullname_new object_file_system.MoveFile file_fullname, file_fullname_new if not object_file_system.FileExists(file_fullname_new) then WScript.Echo "Erreur, le fichier :" & vbCrLf & file_fullname & vbCrLf & "n'a pas pu être renommé." WScript.Sleep 5000 WScript.Quit(0) end if i_my_rename_file = 0 end function if i_installation_type = 1 then i_my_rename_file thunderbird_folder & "\" & thunderbird_corrupted_file_1, thunderbird_folder & "\" & thunderbird_corrupted_file_1 & ".bak" i_my_rename_file thunderbird_folder & "\" & thunderbird_corrupted_file_1 & ".temporary", thunderbird_folder & "\" & thunderbird_corrupted_file_1 end if if i_installation_type = 2 OR i_installation_type = 5 then i_my_rename_file thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1, thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1 & ".bak" i_my_rename_file thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1 & ".temporary", thunderbird_folder_portable_32 & "\" & thunderbird_corrupted_file_1 end if if i_installation_type = 3 OR i_installation_type = 5 then i_my_rename_file thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1, thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1 & ".bak" i_my_rename_file thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1 & ".temporary", thunderbird_folder_portable_64 & "\" & thunderbird_corrupted_file_1 end if if i_installation_type = 6 then i_my_rename_file thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1, thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1 & ".bak" i_my_rename_file thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1 & ".temporary", thunderbird_folder_installed_32 & "\" & thunderbird_corrupted_file_1 end if if i_installation_type = 7 then i_my_rename_file thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1, thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1 & ".bak" i_my_rename_file thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1 & ".temporary", thunderbird_folder_installed_64 & "\" & thunderbird_corrupted_file_1 end if WScript.Sleep 5000 WScript.Quit(0) Il faudra donner au fichier ".txt" l'extension ".vbs".
  9. Bonjour à tous, Depuis quelques temps déjà, j'observe un phénomène assez malaisant proliférer sur Internet : l'écriture inclusive. Avant de passer à la partie code, commençons donc par démontrer logiquement que cette écriture désigne les moutons et les malades mentaux. Définition : Officiellement, le but de l'écriture inclusive est d'éviter de se sentir insulté lorsque son genre n'est pas représenté dans une phrase. Cette définition pose de nombreux problèmes. 1 - Il est impossible de "se sentir insulté". Pour insulter, on utilise des mots précis : clairement référencés comme insultants dans le dictionnaire. Des mots : - soit grossiers ou vulgaires (le plus souvent liés à la sexualité : con, pute, connard, enculé, etc.), - soit faisant référence à une pathologie (mentale de préférence : débile, attardé, trisomique, hystérique, etc.), - soit à un personnage historique décrié (Hitler le plus souvent), - soit liés à un animal (chien, etc.), - soit liés à un objet peu ragoûtant (ordure, etc.). Une langue est un ensemble de règles qui permettent de communiquer, donc ces règles ne doivent pas changer, sinon les gens ne parlent plus la même langue, donc se comprennent plus. Certes une langue évolue, mais uniquement afin de devenir plus pratique dans son usage pour la majorité, pas en fonction d'une idéologie (sinon ça s'appelle la "novlangue"). Si l'on commence à remettre en cause les règles d'une base aussi fondamentale que la langue, alors autant toutes les remettre en cause. Dans ce cas autant rouler à gauche si vous êtes gaucher (ou anglais). Après tout si vous ressentez que rouler à droite n'est pas naturel, si vous sentez oppressé, vous n'avez qu'à rouler comme vous voulez, en allant plus doucement et en faisant attention, ça devrait passer... non ? Il ne faut pas confondre "l'insulte" (ou "l'injure" en droit) avec le fait d'être émotionnellement heurté. L'insulte ne fonctionne pas "au feeling" : l'insulte est formulée avec des mots clairement établis dans chaque langue. Donc l'insulte est quelque chose de binaire : soit tu es insulté, soit tu ne l'es pas. Quelqu'un qui se "sent insulté" est quelqu'un qui ignore le sens des mots : il confond l'injure (l'insulte) avec le sentiment d'être blessé. Il confond l'injure avec des mots qui heurtent ses émotions, le plus souvent juste parce qu'il n'est pas d'accord. Ce qui n'est pas du tout la même chose. Si tu n'es pas d'accord, si des propos te choquent, c'est à toi de contre-argumenter pour te défendre. Si tu ne peux rien répondre parce que tu es choqué, c'est que tu es un fragile (on dit aussi une "baltringue"). C'est-à-dire quelqu'un qui pense avec ses émotions plutôt que sa raison. Si tu ne supportes ni la contradiction ni la polémique, si tes émotions t'empêchent d'argumenter, c'est que tu ne les contrôles pas, donc que tu manques de maturité. Et dans ce cas c'est toi qui as tort, pas la langue française. 2 - Le but d'une langue est de faire passer une idée de manière simple. L'écriture n'est pas faite pour être agréable ou se sentir bien. Elle peut blesser et c'est une bonne chose : c'est comme ça qu'on évolue, qu'on grandit, qu'on gagne en maturité. C'est par la contradiction et la polémique que l'on réfléchit, si tu lis uniquement des choses qui vont dans ton sens, alors tu ne progresses pas. Donc en écrivant, on ne se préoccupe du genre que quand c'est utile. Pas tout le temps, sinon c'est hors-sujet. Si tu te préoccupes du genre des mots en permanence, même lorsque c'est hors-sujet, c'est que le genre t'obsède. Et si le genre t'obsède, c'est que le sexe t'obsède, donc que tu es "frustré" par définition. Exemple : Le 9 janvier 2015, hyper-cacher porte de Vincennes, les terroristes entrent dans le bâtiment et tu as juste le temps d'envoyer un SMS. Tu écris : "Au secours, on est attaqués par des terroristes !". Tu n'as pas le temps de te préoccuper de ce qu'il y a dans la culotte des gens, c'est sans importance. Si tu écris : "Au secours, on est attaqué·e·s par des terroristes !", si tu prends le temps d'écrire un truc aussi compliqué dans une telle situation, c'est que le genre t'obsède plus que ta propre survie, donc qu'il y a un grave problème de structure dans ta tête. 3 - Le genre neutre invisibilise tout le monde. 5ème Siècle : l'empire romain s'effondre. L'administration est désorganisée, les provinces de l'empire ne sont plus défendues. Sans armée, la Gaule est livrée à elle-même. Les barbares passent les frontières, pillent, violent et massacrent. Plusieurs langues sont alors parlées en Gaule : latin et grec (vestiges de l'empire romain), et les langues barbares. 9ème Siècle, les barbares se sont regroupés, organisés, ils ont cessé d'être des barbares. Une ancienne tribu barbare d'origine germanique, les "Francs" contrôle une grande partie du territoire. Leur langue est le "francique" : un patois germain avec des composantes celtiques. Ces composantes celtiques donneront par exemple les nasales du français, si difficile à prononcer pour les autres peuples. Demandez à un anglais de dire "en un on", vous allez bien rigoler... 9ème Siècle : naissance de l'ancien français (le "vieux françois"), qui mélange principalement 3 langues : Latin + Grec + Francique. Latin et Grec sont des langues d'origine indo-européenne. Comme toutes les langues indo-européennes, elles possèdent 3 genres : masculin, féminin et neutre. He She It, It rains (anglais), Er Sie Es, Es regnet (allemand), Hij Zij Het, Het regent (néerlandais), Han Hun Det, Det regner (norvégien), Él Ella Eso, Eso llueve (espagnol), Lui Lei Esso, Esso piove (italien), Ele Ela Isso, Isso chove (portugais), Ille Illa Illud, Illud pluerit (latin) Αυτός Aυτή Aυτό, Aυτό bρέχει (grec), Hann Hún Það, Það rignir (islandais), அவன் அவள் அது, மழையது பெய்கிறது (tamoul), सः सा इदम्‌, वर्षा भवति (sanscrit)... Il y a toujours une forme neutre... sauf en français. Le latin contient 6 cas (nominatif, vocatif, accusatif, génitif, datif, ablatif), 2 nombres (singulier et pluriel), et 3 genres (masculin, féminin et neutre) auxquels s'appliquent 5 déclinaisons. Ce qui fait 6 × 2 × 5 = 60 terminaisons de mots à retenir. Un cauchemar. Avantage : tant qu'on met la bonne terminaison aux mots, on peut changer leur ordre sans perdre le sens de la phrase. Inconvénient : 5 tableaux de déclinaisons à savoir par cœur, et à la moindre erreur la phrase perd son sens. Le vieux français simplifie : on supprime les déclinaisons. Avantage : Pas de tableau de déclinaisons, c'est beaucoup plus simple. Inconvénient : On ne peut plus changer l'ordre de certains mots, sinon on perd le sens de la phrase. Anecdote : le français n'est pas la seule langue à faire des remaniements. En anglais, le genre des mots est supprimé : un homme, une femme => a man, a woman Plus tard, l'anglais va même supprimer la nuance hiérarchique. Les langues indo-européennes contiennent habituellement 2 formes : le "tu" (absence de hiérarchie) et le "vous" (présence d'une hiérarchie, supérieure ou inférieure). L'anglais va supprimer le "thou art" (tu es) pour mettre du "you are" (vous êtes) partout : les anglais se vouvoient en permanence. Ironie, le "thou art" reviendra ensuite comme forme de politesse ultime (pour s'adresser à la royauté et à Dieu). Le vieux français va aussi supprimer le genre neutre. Le latin "Ille Illa Illud" devient "Il elle Il" en français. He She It, It rains (anglais) => Il Elle Il, Il pleut (français) Il ne reste aussi que 2 cas, nominatif et accusatif. Par exemple "copain" est la déclinaison au nominatif de "compagnon", à l'origine c'est le même mot. Ces déclinaisons vont disparaître au 14ème Siècle. Il reste finalement 2 nombres (singulier et pluriel), et 2 genres (masculin et féminin). Mais le neutre n'a pas complètement disparu, il en reste des résidus. Le pronom personnel neutre ("it") devient "il", mais le pronom démonstratif neutre ("this") devient "cela" (ou "ça"). "It is impossible to do this !" => "Il est impossible de faire ça !". Le neutre n'a pas complètement fusionné avec le masculin, sinon "This is it !" donnerait "C'est lui !" au lieu de "C'est ça !". En réalité, le genre neutre n'a pas été "supprimé", il a été réparti entre masculin et féminin. Ainsi les mots "sein", "vagin" et "utérus" sont masculins, et ça n'a rien de sexiste. Tout comme le mot "testicule" est féminin, et ça n'a rien de castrateur. Une "horde" de barbares, le mot est féminin alors que les barbares sont masculins. Le mot "intelligence" est féminin, et les hommes n'en font pas un scandale. L'éducation nationale nous a appris que quand il y a 1 garçon dans un groupe de X filles, on accorde au masculin. En réalité c'est faux : on accorde au neutre. Le pronom personnel neutre latin "Illud" est juste devenu "Il". Pourquoi "Il" et pas "Elle" ? Pour des raisons d'économie de caractères, c'est plus court donc plus économique. La formulation "le masculin l'emporte sur le féminin" est fausse, c'est une vulgarisation faite pour les gamins. En réalité avec un groupe de genres divers, par commodité on écrit au plus court. Tout simplement. Les militants de l'écriture inclusive reprochent au genre masculin-neutre d'invisibiliser les femmes du groupe. C'est faux : le genre neutre n'invisibilise pas que les femmes, il invisibilise tout. Quand on écrit "Chers lecteurs", on sait très bien qu'il peut y avoir des lecteurs, des lectrices, des transsexuels, des intersexuels, des non-binaires, des genders fluid, des IA, des anges, des démons, Dieu, absolument n'importe qui ou n'importe quoi. Le neutre regroupe tout : les hommes, les femmes, les personnes, les objets, les indéfinis, etc. 4 - L'écriture inclusive, la marque des intolérants. Quand on écrit "Cher·e·s lecteur·trice·s", on réduit le neutre au masculin. Donc il ne peut plus y avoir que des hommes et des femmes, l'écriture inclusive nie l'existence de tout le reste. Donc par définition, l'écriture inclusive est transphobe et anti-LGBTQIA+. L'écriture inclusive est utilisée par des gens prétendant qu'il existe une multitude de genres, pourtant elle les réduit à seulement 2. L'écriture inclusive est totalement binaire, mais utilisée par des gens qui prétendent que l'on peut être non-binaire. Celui qui écrit en inclusif considère non seulement qu'il y a uniquement 2 genres, mais en plus il se sent insulté lorsque son genre n'est pas représenté. Donc il met hommes et femmes en opposition. Il confond le genre des mots avec le genre des gens, et il considère que le genre de l'autre est une insulte. L'écriture inclusive sert donc à ne surtout pas être confondu avec l'autre. Par définition, ça s'appelle de "l'intolérance". C'est de la discrimination liée au sexe, donc du "sexisme". Une femme qui utilise l'écriture inclusive sous-entend : "je ne suis pas sexiste mais si on me confond avec un mec ça va chier !". C'est l'équivalent de : "je ne suis pas raciste mais si on me confond avec un bougnoule ça va chier !". La plupart des gens qui écrivent en inclusif ne pensent pas à cela. Ce sont juste des moutons adeptes de la secte du conformisme, dont le troupeau suit la direction donnée par les gourous de la propagande, sous la menace des chiens de garde militants. La plupart des gens sont trop stupides pour réfléchir sur le sujet, et trop lâches pour s'opposer au militants. Le militant de l'écriture inclusive, lui, ne supporte pas l'idée d'être confondu avec le genre de l'autre, pour lui c'est une blessure émotionnelle (qu'il prend pour une insulte). Donc au lieu de gommer les oppositions avec le masculin-neutre pour rapprocher les gens, il accentue les oppositions avec l'écriture inclusive pour diviser les gens. Ce qui fait ressortir sa haine et sa peur de l'autre. 5 - L'écriture inclusive confond le fond et la forme. Ce n'est pas l'arme qui tue quelqu'un, c'est celui qui s'en sert. Ce n'est pas la langue française (la forme) qui est sexiste, c'est l'utilisation qu'on en fait (le fond). Si j'écris "La·es femme·s doit·vent rester à sa·leur place, et la place de·la·des femme·s c'est à la cuisine", j'ai beau écrire en inclusif ça reste sexiste. Si la langue rendait sexiste, alors il n'y aurait pas de sexistes dans les pays anglophones. Osez me dire qu'il n'y en a pas ? Confondre le fond et la forme, on appelle ça avoir une pensée "destructurée". 6 - L'écriture inclusive, imprononçable, illisible, inutile, validiste, gauchiste, anti-écologique et illégale. - Avez-vous déjà essayé de prononcer de l'écriture inclusive à haute voix ? Impossible car c'est imprononçable. Et les militants de l'écriture inclusive le revendiquent, selon eux c'est pour le langage écrit uniquement. À l'oral, on repère ces militants car ils se sentent systématiquement obligés de rajouter du féminin partout : lecteurs ET LECTRICES, auteurs ET AUTRICES, joueurs ET JOUEUSES, agriculteurs ET AGRICULTRICES, conducteurs ET CONDUCTRICES, utilisateurs ET UTILISATRICES, mathématiciens ET MATHÉMATICIENNES, frères ET SŒURS, CELLES ET eux (systématiquement répété)... C'est tellement lourd. - Le but de l'écriture est de représenter une prononciation orale. Donc une langue écrite qu'on ne peut pas prononcer ne sert à rien, elle est inutile. - Avez-vous déjà essayé de mettre de l'écriture inclusive dans un synthétiseur vocal pour aveugles ? C'est incompréhensible. Donc l'écriture inclusive est "validiste" : elle exclue les handicapés. - L'écriture inclusive ne sert que pour le langage écrit. C'est donc un truc de militants qui restent derrière leur ordinateur, qui ne vivent pas dans le monde réel, qui sont déconnectés de la réalité. Des militants qui énoncent de grands dogmes universels de manière péremptoire, comme le feraient les fanatiques d'une secte obscurantiste, les idiots-utiles de la secte des "conformistes" (dont les gourous sont les médias mainstream). Ils se bornent à la théorie, mais jamais ne sortent pour la confronter à la pratique. Et lorsque le réel contredit la théorie, ils font du déni de leurs échecs. Ces militants pseudo-intellectuels, Lénine les appelle des "gauchistes", et il les qualifie de "malades mentaux" dans son livre "La maladie infantile du communisme". Ce sont souvent des petits bourgeois mal-éduqués par des parents aisés, car vivre déconnecté de la réalité a un certain coût, il faut pouvoir se le permettre. Par définition, la "folie" regroupe 2 composantes : - une pensée qui semble incohérente - et une auto-destruction (sur le plan biologique). La seconde différencie le fou du génie : le génie réussit à avoir un conjoint et des enfants, et à les élever correctement pour avoir des petit-enfants. Le fou ne réussit pas à trouver un conjoint ou à le garder, il n'a pas d'enfant ou de petit-enfant et sa lignée s'éteint : il a (biologiquement) raté sa vie. Le gauchiste possède ces 2 composantes : des contradictions à tous les niveaux et une vie ratée. Par définition, le gauchisme est donc une "maladie mentale", Lénine ne s'est pas trompé. - L'écriture inclusive rallonge considérablement les phrases, d'au moins 10%. Maître Corbeau sur un arbre perché, Tenait en son bec un fromage. Maître Renard, par l'odeur alléché, lui tint à peu près ce langage : Et bonjour, Monsieur du Corbeau. Que vous êtes joli ! que vous me semblez beau ! Sans mentir, si votre ramage se rapporte à votre plumage, vous êtes le Phénix des hôtes de ces bois. À ces mots, le Corbeau ne se sent pas de joie ; Et pour montrer sa belle voix, il ouvre un large bec, laisse tomber sa proie. Le Renard s'en saisit, et dit : Mon bon Monsieur, apprenez que tout flatteur vit aux dépens de celui qui l'écoute. Cette leçon vaut bien un fromage, sans doute. Le Corbeau honteux et confus jura, mais un peu tard, qu'on ne l'y prendrait plus. Maître·sse corbe·au·lle sur un arbre perché, Tenait en son bec un fromage. Maître·sse Renard·e par l'odeur alléché·e lui tint à peu près ce langage : Et bonjour, Monsieur·Madame di Corb·au·lle ! Que vous êtes joli·e ! que vous me semblez be·au·lle ! Sans mentir, si votre ramage se rapporte à votre plumage, vous êtes li Phénix des hôte·sse·s de ces bois. À ces mots li Corbea·u·lle ne se sent pas de joie ; Et pour montrer sa belle voix, il·elle ouvre un large bec, et laisse tomber sa proie. Le·a Renard·e s'en saisit, et dit : Ma·on bon·ne Monsieur·Madame, apprenez que tout flatteu·r·ses vit aux dépens de celui·elle qui l'écoute. Cette leçon vaut bien un fromage sans doute. Le Corbe.au.lle honte.x.se et confus.e jura, mais un peu tard, qu'on ne l'y reprendrait plus. C'est du gaspillage d'octets, d'encre et de papier. Par définition c'est anti-écologique. - (Argument d'autorité) L'écriture inclusive est illégale car fermement rejetée par l'Académie française, qui la qualifie de "péril mortel pour la langue française" et "d'aberration". https://www.academie-francaise.fr/actualites/declaration-de-lacademie-francaise-sur-lecriture-dite-inclusive 7 - La marque de l'idiot utile du capitalisme néolibéral. Lorsque l'on analyse les financements de l'écriture inclusive, on découvre toute l'oligarchie qui œuvre pour détruire les États-nation et esclavagiser la population. Fortement rejetée par la population aussi bien que par les instances officielles, l'écriture inclusive est donc aujourd'hui ré-introduite par le biais de sociétés privées : Meta, WhatsApp, Mozilla, Wikipédia, etc. Et comme un cancer, elle envahi petit à petit les instances officielles, même le site des impôts commence à s'y mettre. https://www.impots.gouv.fr/particulier/questions/je-suis-assistante-maternelle-comment-dois-je-declarer-mes-revenus Nous avons donc des militants d'extrême gauche, censés combattre le capitalisme néolibéral, qui sont les idiots utiles de ce néolibéralisme. 8 - Une écriture exclusive de militants politiques mal-baisés, et surtout mal-aimés. Auparavant, quand on voulait appuyer que l'on pensait aussi à la gente féminine, on pouvait mettre des parenthèses : "Cher(e)s abonné(e)s". Avec l'écriture inclusive, cette forme pompeuse est poussée à l'extrême : elle marque désormais une opposition homme-femme en permanence. Le problème c'est que biologiquement, homme et femme sont complémentaires : l'un ne peut survivre sans l'autre. Donc créer une opposition ne peut que détruire les deux. Ainsi, ceux qui inventent des oppositions homme-femme (les ultra-féministes par exemples) finissent leur vie frustrés et malheureux. Hélas nous vivons dans une société athée, donc une société où les valeurs morale, et donc la culture, et donc le niveau intellectuel s'effondrent. Une société où ce sont des ratés de la vie qui dictent aux enfants comment vivre la leur. Ce qui est finalement logique : celui qui se noie cherche souvent à entraîner les autres avec lui. L'une des conséquences de cet effondrement est la promotion de ces personnes hautement frustrées, rongées par un manque affectif. Manque affectif venant du fait qu'elles n'ont jamais réfléchi à la définition de l'amour. Des personnes dont les actions vont à l'opposé de ce qu'elles désirent : ce n'est pas en accusant les autres de nos problèmes qu'ils vont nous aimer. "Dieu se rit des Hommes qui se plaignent des conséquences dont ils chérissent les causes". "Changer le monde commence par se changer soi-même". Selon ces gens frustrés et malheureux, le problème vient forcément des autres, de la société, du système, de la langue française, certainement pas d'eux. Donc il faut un combat politique pour changer tout cela. Donc nous avons des gens malheureux, frustrés, dont la propagande fait la promotion, qui canalisent leur frustration dans un combat politique (d'extrême gauche). Et l'écriture inclusive est un marqueur de leur appartenance à ce combat. Finalement l'écriture inclusive est en réalité exclusive : elle exclue tous ceux qui ne partagent pas la frustration et le combat politique du rédacteur. 9 - Une écriture qui relève de la psychiatrie. Récapitulons : le militant de l'écriture inclusive se prétend - socialiste, communiste, marxiste, léniniste ou trotskiste, - lucide pour combattre le système, - fort, mature, heureux, mentalement structuré, - tolérant envers les femmes et les minorités, - altruiste, modeste et à l'écoute, - tourné vers l'environnement et l'écologie. En réalité, le militant de l'écriture inclusive est - un gauchiste, militant politique fanatique obscurantiste paumé que Lénine qualifie de malade mental, - manipulé comme un idiot utile du système, - une baltringue immature frustrée et destructurée, - intolérant, sexiste, transphobe, anti-LGBTQIA+, validiste, - égoïste, orgueilleux et extrémiste, - tourné vers le gaspillage et le green-washing. Et qui pour cela utilise une écriture hors-sujet, trop longue, trop compliquée, imprononçable, inutile, illégale... et exclusive. Ces extrémistes sont si obsédés par leurs frustrations sexualo-affectives qu'à chaque petit mot qu'ils écrivent, ils pensent systématiquement à ce qu'il y a dans la culotte des autres. Ça les obsède, ça tourne en boucle dans leur tête, la frustration les dévore de l'intérieur, ils ne pensent plus qu'à ça. Ça les obsède tellement qu'ils ont créé une nouvelle façon d'écrire pour exprimer cette frustration. Le militant de l'écriture inclusive voudrait modifier la langue française pour qu'elle reflète son combat politique. C'est exactement comme un militant platiste qui voudrait modifier Google Earth et les livres de géographie pour expliquer que la Terre est plate, ou un créationniste qui voudrait modifier les livres d'Histoire pour dire que Dieu a créé le monde en 7 jours il y a 2000 ans, ou un colonialiste qui voudrait modifier les livres d'Histoire pour dire que la colonisation n'a eu que de bons aspects. Il s'agit de modifier la réalité pour qu'elle colle à une idéologie : c'est de l'extrémisme, donc de la folie. Celui qui écrit en écriture inclusive a donc besoin d'un psychiatre : c'est un "fou" par définition, un "malade mental". Comme le disait Lénine, le gauchisme est une maladie mentale, et l'écriture inclusive est la marque des gens qui en sont gravement infectés. 10 - Les militants du politiquement correct de l'écriture inclusive, des nouveaux nazis. Historiquement, tous les groupes extrémistes ont inventé leur propre vocabulaire, leur propre novlangue. Par exemple, le camp de torture S-21 à Phnom Penh explique l'étrange vocabulaire des Khmers Rouges. Leur novlangue leur permettait de s'identifier entre eux, et de dépister celui qui réfléchissait trop en dehors des dogmes. Ce qui finissait toujours par arriver, ainsi les bourreaux finissaient toujours par se faire eux-mêmes torturer et tuer. La même chose est arrivée pour Staline, Hitler et Mao Zedong : l'entourage se faisait progressivement soupçonner de trahison et tuer. Les milices de Staline et les marcheurs de Mao Zedong utilisaient aussi leur novlangue. Idem pour les nazis, leur novlangue est bien documentée dans un livre appelé "Lti, la langue du IIIème Reich" de Victor Klemperer. Le même phénomène s'observe aujourd'hui avec les conformistes du politiquement correct (les wokes) : création d'une novlangue parallèle politisée. Lorsque quelqu'un insiste sur le féminin, ou utilise l'écriture inclusive, ça veut dire : "Regardez-moi je suis frustré(e), extrémiste, intolérant(e) et très mal dans ma tête". Normalement, l'utilisation d'une écriture aussi déviante devraient éveiller un sentiment de honte. Mais l'abolition de la honte est l'un des principaux symptômes des maladies mentales. Aussi il est de mon devoir de m'opposer à cette écriture inclusive : il faut lutter contre l'extrémisme, c'est une question d'hygiène. Naturellement, le militant de l'écriture inclusive est extrémiste, donc incapable d'argumenter, il ne répond que par la censure et l'insulte. Aussi je ne m'étonnerai pas que moult amoureux de la Liberté d'Expression, des Droits de l'Homme et de la Démocratie, qui en 2015 pleuraient du Voltaire en hurlant "Je suis Charlie !", ne harcèlent activement les modérateurs pour demander la censure de ce post. Firefox et Thunderbird : Habituellement, j'abandonne les applications écrites en inclusif. Les gauchistes étant toujours des parasites économiques, ils ont du temps à perdre pour pourrir Internet avec leur pensées malsaines. La Fondation Mozilla a aussi été gangrenée par le wokisme et son gauchisme. Mais j'aime bien les logiciels Firefox et Thunderbird, donc je vais prendre un peu de temps pour faire autrement. Voici une méthode simple pour nettoyer ces logiciels de leur écriture inclusive.
  10. Bonjour à tous, Dans un vieil article de NextInpact de 2019 ou 2020, l'auteur faisait références aux bizarreries de la mécanique quantique, type dualité onde corpuscule, téléportation quantique, principe d'incertitude (superposition quantique), de non-localité, effet tunnel, etc. Et l'auteur mentionnait un truc supplémentaire dont on entend peu parler. Ça m'avait interloqué, j'avais trouvé une entrée Wikipedié sur le sujet, mais non citée dans l'article original sur la mécanique quantique. Et pas moyen de retrouver l'article de Next Inpact, ni l'article de Wikipedia. Auriez-vous une idée de ce que peut être cette bizarrerie liée à la mécanique quantique svp ?
  11. Il y a 2 phrases à lire, qui tiennent sur 4 lignes. Ça m'a pris 10 secondes en me tenant à 80 cm de la webcam intégrée à mon PC portable. Donc rien d'insurmontable. Par contre, il faut se tenir dans une pièce sans bruits, quand j'ai essayé de dicter avec mon fils de 6 mois qui hurlait derrière, le micro ne comprenait rien.
  12. Je suis en train de tester Dragon. Je pense que je vais l'acheter. En dehors d'un raccourci clavier foireux (commande SOULIGNER renvoie sur CTRL+s au lieu de CTRL+u) sur Word qui t'enregistre le document au lieu de souligner, je n'ai trouvé aucun problème. Il fonctionne à merveille juste avec le micro de la webcam intégrée à mon PC. Je l'avais déjà testé il y a 10 ans, mais là les progrès sont spectaculaires. Et en effet, il est complètement offline, je le teste avec un PC acheté en 2017 core i7 8ème gen et 16 Go de RAM, il me mange 7% du CPU et 20% de la RAM, ce qui est largement acceptable, pour une précision bluffante.
  13. En fait, en creusant, j'ai l'impression qu'il n'y a que Dragon en Offline. La quasi-totalité des logiciels de reconnaissance vocale utilisent des services en ligne, le plus souvent l'API de Google qui semble être la meilleure. Déception.
  14. En fait, Braina a l'air d'être une arnaque. Le truc semble utiliser l'API de Google Voice Typing et est obligé d'être connecté à Internet pour fonctionner. Le foutage de gueule ultime est sur ce site, où ils t'expliquent que pour que la reconnaissance vocale fonctionne quand tu n'es pas connecté à Internet, il faut utiliser un hotspot Wi-fi avec ton téléphone. https://blog.brainasoft.com/offline-dictation-speech-recognition-windows/ Genre ils font comme si tu n'étais pas connecté à Internet quand tu es en hotspot, ils confondent "connexion à Internet" et "connexion Wi-Fi", ça m'a tout l'air d'être une arnaque pour les noobs.
×
×
  • Créer...