Aller au contenu
View in the app

A better way to browse. Learn more.

Next

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Classement

  1. Aloyse57

    Stormtrooper
    7
    Points
    2 172
    Compteur de contenus
  2. r.chatigré

    Stormtrooper
    7
    Points
    2 497
    Compteur de contenus
  3. Onesque

    Équipe Next
    6
    Points
    12
    Compteur de contenus
  4. gogoal

    Stormtrooper
    3
    Points
    1 164
    Compteur de contenus

Contenu populaire

Affichage du contenu avec la meilleure réputation depuis le 10/09/2025 dans toutes les zones

  1. Hello, pour l'instant, il n'y a rien eu non, je pensais le signaler à l'occasion du prochain Poing Dev (mais quand arrivera-t-il, je ne sais pas encore :p) Merci pour vos propositions sur les sections du forum, je trouve ça intéressant de garder d'un côté les demandes liées au fonctionnement du matos ou aux choix d'équipement, et de l'autre tout ce qui touche à la configuration "avancée", quel que soit le nom qu'on lui donne (perso en ce moment j'overclocke pas, je cherche plutôt à downclocker, la faute au grille pain 5800X :D) Avant de toucher à la structure du forum, il faut quand même qu'on regarde avec les admins (enfin avec des gens qui connaissent bien invision, ce qui n'est pas mon cas) ce qui se passe en cas de déplacement de sujets, fermeture de catégories etc, pour essayer de ne pas perdre de contenu et de liens au cours du processus, notamment vis à vis des archives. Une fois qu'on aura fait cette petite vérification, on connaitra plus précisément nos marges de manœuvre, à ce moment là ça pourrait être sympa d'en discuter ensemble via Discord ou autre, avant de trancher.
  2. @kamuisuki Je reprends la proposition (j'ai mi en gras/italique/souligné mes modifs): Software & systeme exploitations -Windows -Mac/ios -Linux, android & les autres -Logiciels Hardware & achat/ventes -Conseils config -Composants -- Section occasion/vente rachat) -Périphériques -- Section occasion/vente rachat) -Ajustement/personnalisation (Oc,Undervolting ,etc..) Reseau et programmation -Reseau (Cloud, LAN,internet..) -Programmation (languages, outils de programmation, IA...) -Domotique / IOT Multimedia -Jeux video (Jeux, consoles, retrogaming..) -Creation audio, video, web, etc.. Café & Forum Espace libre Les jeux (jeux de forum..) Le Forum Section privée.(si vraiment necessaire).
  3. Mon avis de pur Windowsien : utiliser une méthode de contournement pour installer Windows 11 est possible, pas si compliquée mais reste soumise au risque de tomber caduque lors d'une mise à jour. J'ai un paquet de PC non compatibles qui tournent depuis l'avènement de Windows 11 ; par habitude, je convertis toutes mes machines au dernier OS de Microsoft. L'exception ça a été avec Windows 8, parce qu'il était orienté tactile. Sans tactile, c'était pour le moins difficile (coucou la CharmBar). Aucun de ces PC, ça va du Atom au Ryzen7, n'a eu de problème de mise à jour, quand elles pouvaient avoir lieu. Je précise : je me retrouve avec des machines avec des W11 différents car certaines n'acceptaient pas de passer à la suivante sans réinstallation. Ça fait trop de boulot pour pas grand-chose, donc je laisse courir. De plus, j'ai remarqué que chaque version de W11 est plus gourmande que l'autre. Aujourd'hui, pour que ça reste fluide, il faut 16GB de RAM, alors que pour la première version 8 étaient plus que confortable. J'ai des Atom avec 4GB et ça tient pour une tâche unique (ce sont des Pipo 10). Pour un usage pro avec des fichiers Excel ouverts en parallèle de pages web, 32GB sont nécessaires. Tout ça pour dire que si rester bloqué à une version N de W11 ne vous dérange pas, alors rester à W10 ne devrait pas non plus. À moins d'être un utilisateur à risque, il ne va rien se passer de mal en restant avec W10. Un jour votre navigateur ou un site web vous dira qu'il faut une version plus récente, ce jour là vous changerez. Les seules raisons valables qui peuvent motiver de passer de Windows à Linux, ce sont à mon avis l'IA que MS veut nous enfoncer dans la gorge avec Recall en particulier et les abonnements à n'en plus finir pour tout et pour rien (Compte MS, 365, lecture DVD, lecture photos HEIC, ...)
  4. Une imprimante 3D Bambulab H2D+AMS2 pour remplacer ma Prusa MK2S, totalement dépassée. Un laser XTool Ultra F2+recycleur d'air pour remplacer le F1 trop petit, pas assez puissant. Je n'assume pas encore l'achat du F2 tellement c'est une folie financière ; ce sont des hobbies, zéro raison commerciale derrière.
  5. un SSD et CPU moyen sont un minimum, après viens la qualité de l'écran. Mais surtout il faut voir quels sont tes besoin et ton budget pour affiner les recommendantions
  6. Il y a tellement de facteurs.... J'essais toujours de trouver un portable avec RAM/Disque changeable, et viser le meilleurs CPU dispo dans la tranche de prix fixé. Pour la marque, soit j'ai un petit budget et je ne fais aucun trie sur la marque je me base uniquement sur le rapport prix/perf/évolutivité. Soit j'ai un budget me permettant de taper dans les vrai marque qui vise les pros : genre Lenovo Thinkpad (Edge qui son un peu plus accessible mais qui reste solide) Donc je me retrouve rarement avec un "MSI", "ASUS" ou équivalent qui pour moi sont des "pseudo marque" mais dont le prix est déjà impacté par le nom. Dure choix à faire aussi concernant le type de CPU (TDP faible autour de 15w) ou fort (les 35/45w). La on est vraiment dans un choix de confort/autonomie vs puissance. Au dessus de 45w ou avec un GPU puissant, je passe mon tour, trop horrible le bruit. Les 35/45w peuvent déjà être fatiguant avec la chaleur et le bruit produit. Portabilité : dans mes usages et ceux de mes proches, les ordi portable sont rarement sur les genoux pendant 5h sans prise dispo pour la charge. Bref je ne regarde pas trop à l'autonomie. Un bon compromis peut aussi être un portable "game pro" en reconditionné ou seconde main. Un prix maitrisé et une qualité supérieur. Mais le rapport prix/perf en prend forcement un coup. Pour les disques, pas de sujet : NVME On est plus sur de la nouvelle techno "chère" depuis bien longtemps. A moins d'être sur un portable d'occaz' à 100 balles, on ne devrait pas trouver autre chose.
  7. @tous les trois merci pour vos réponses.
  8. La remarkable, j'ai eu l'occasion de l'essayer, c'est vraiment du beau matériel. Les paperslate, c'est tout nouveau, elles ont des défauts (la résolution) et des avantages (la conversion des notes en diagramme a l'air pas mal sur le papier). La boox go, avec son android intégré, elle est plus versatile: avoir la possibilité de naviguer et récupérer les PDF des cours depuis la liseuse, au lieu de passer par un ordi, c'est excellent. Et pouvoir mettre des applis comme webtoon, c'est le must d'après ma fille.
  9. Bof. Nous on a préféré les Onyx Boox d'occasion, format 9" (le modèle avant les Boox Note). Plusieurs jours d'autonomie, Android 9/10. Prise de notes, marquage de PDF, lecture de manga ... Compagnon ultime en cours, jamais à court de jus, démarre quasi instantanément, permet de continuer à lire les notes éteint. Achetée d'occas, elles ont 3 ans (une pour ma fille, une pour ma femme), la batterie tient toujours plusieurs jours. Ma fille a testé la capacité à dessiner, aucun problème non plus (support des niveaux de pression), un perso de manga + le décor dessinés très rapidement. Petit bémol: pas d'extension mémoire possible, donc les mangas tapent fort (certains pèsent près de 2Go) La bookeen notéa semblait pas mal non plus. Edit: Boulanger m'a soufflé que je pourrais être intéressé par la paperslate: Test Paperslate Pro : le bloc-notes français dopé à l'IA qui veut bousculer reMarkable
  10. Vous pouvez couper la poire en deux : créer un autre compte local avec le profil admin, copier les menus, raccourcis dans le nouveau profil puis supprimer l'ancien. Il y aura peut-être quelques logiciels à réinstaller, mais pas tant que ça.
  11. @kamuisuki il manque peut-être une section "Configuration" ou autre pour adresser les demandes de conseil pour monter un ordi complet (ça arrive très souvent ces temps-ci ^^ ) et pour les conseils d'achats sur des pc déjà montés. Ou vous voyiez ça dans une des sections déjà citées dans votre liste ?
  12. Je fais surtout du marquage (identification) indélébile : appareils, outils, donc métal et plastique. Les 2 soucis majeurs que j'ai eu avec le F1 (mon premier laser), c'étaient : 1/la puissance : il faut de la puissance pour marquer certains métaux, surtout s'ils sont clairs, non couverts par une teinture foncée. Exemple le fer brut. 2/la hauteur entre le laser et le socle : ce type de laser est appelé galvo car lui ne bouge pas. le faisceau se déplace avec des miroirs. Il faut donc changer la focale en fonction de la distance entre le point d'impact et le laser. Avec le F1, je ne pouvais pas mettre une pièce de plus de 15cm. Alors oui, techniquement je peux ôter une partie de la base, c'est un appareil portable ; mais autant que l'est un laptop de gamer avec la 5090 à fond 😉. Autant faire tenir ledit laptop en équilibre sur le manche d'une tronçonneuse en tentant de dessiner un cercle sous Paint avec le touchpad, sans le débrancher du bloc l'alim 24v... Enfin, avec la puissance vient un bénéfice : le gain de temps. Certes je l'utilise comme hobby, mais c'est comme les PCMasterRace et l'impression 3D : ça ne va jamais assez vite ! Pour se faire une idée, graver en surface un texte+image de dimension 50mmx30mm sur de l'aluminium powder-coated, sur le F1 ça prend 15minutes, tandis qu'une médaille de chien en alu coloré (anodisé), 10 secondes. L'inconvénient, en dehors du prix d'achat : l'espace. Aussi bien pour la H2D que pour le F2, il faut de la place et des meubles solides. A eux deux et le recycleur d'air, ce sont 70Kg à vide, 1,60m de large (sans la bobine 3D latérale), 1,40 de haut de dégagement pour ouvrir l'AMS de la H2D ou le volet de sécurité du F2. Les 2 ne peuvent pas être côte à côte car la H2D en impression, c'est un batteur à oeufs (ou une IBM 4230 pour les plus vieux) : ça bouge à une vitesse terrible et ça crée des rétroactions dans le meuble. Les chocs répétés tueraient les galvos du F2😱. Pour en finir, le F2 est surtout fait pour la gravure de métal. Graver ce n'est pas découper. Ça ne fonctionne pas avec les objets transparents, sauf le verre si je le recouvre d'abord de peinture à la craie noire, ça peut être pénible avec le blanc et gris. Pour graver des objets style Arc de Triomphe dans une bulle de verre, il faut un Laser UV. Pour découper et non pas graver, il faut un laser CO2 au minimum. Autant je peux découper une tôle d'alu de boîte de Coca comme un rien, graver en profondeur une tasse de porcelaine foncée, de l'ardoise ou de l'acier stainless, autant je vais galérer pour réussir à écrire sur un vulgaire papier carton blanc ciré (et souvent ça bave). C'est beaucoup d'essais-erreurs avant de trouver les bons réglages qui ne sont valables que sur la machine sur laquelle on travaille. Rappels : Jamais d'enfants dans la pièce où il y a un laser. Garder un extincteur à proximité. Toujours avoir un détecteur de fumée. Porter les lunettes adaptées quand le laser fonctionne.
  13. Alors à mon humble niveau, sur le lien, ça explique plutôt comment faire valider tes modules par le secure boot en te créant des clés valides pour les faire avaler par le secure boot. J'ai eu ce souci récemment avec la remise en vie d'une 560 ti sur une machine avec le secure boot activé. En fait, sur une installation basique de ta Debian ou Ubuntu par exemple, tu auras par defaut le driver Nouveau pour ta CG NVIDIA, ton secure boot t'embête pas car ça utilise la clé de la distribution, par contre tu veux les drivers de NVIDIA qui utilisent dkms ça change la donne. Grosso modo à chaque maj de noyau ça recompile à la volée le driver et le colle en module qui lui n'est pas signé et le secure boot te bloque son lancement (les linuxiens avec driver NVIDIA se fadent une recompile des drivers NVIDIA à chaque nouveau noyau gérée par dkms). Soit tu le desactives pour pas être embêté et tu perds l'avantage du secure boot, soit tu crées des clés valides pour faire valider ces fameux modules. Tu n'as pas ce souci avec AMD car driver libre et très satisfaisant, Nouveau est par contre très limité. En fait tu crées des clés supplémentaires qui valident ces modules initialement non signés. N'hésitez pas à me corriger.
  14. Je peux parler d'expérience. Ma voiture est une Ioniq5 (coucou @Gwanana ). J'avais déjà équipé ma maison avec une prise extérieure pour la génératrice (Westinghouse iGen5000DF). J'ai un système pour basculer la charge (EDF ou GEN) pour un nombre réduit d'appareils, ceux à conserver (en été les frigo+congélateur, en hiver les chauffages d'appoint). J'ai une contrainte que vous n'avez pas : le voltage. Ici nous avons 2 voltages : le 120V et le 240V. Le 120v est une phase, ce qui signifie que nos prises sont sont soit sur une, soit sur l'autre. Donc il faut bien penser à la répartition, car une génératrice 120V (mon cas) ou la IONIQ ne peuvent qu'alimenter 1 phase, pas les deux ! Dans votre cas FR, la voiture va juste délivrer du 220V sur le circuit monophasé. Maintenant, est-ce pratique ? Ça dépend surtout de la fréquence et la longueur des coupures. Alimenter la maison avec la voiture c'est facile, propre et se fait en un clin d'oeil. Mais si jamais vous avez besoin soudainement d'aller à l'hosto à 50km en plein hiver à -25°c (32KW/100km), vous êtes faits (vous voyez le vécu 😐?) La génératrice, son démarrage va être plus pénible (surtout en dessous de -15°c), c'est bruyant même dans un caisson et ça émet des gaz dangereux. Mais ça tourne des heures et il suffit de remplacer la bonbonne (je fonctionne au propane, j'en ai toujours 2 car j'ai aussi un BBQ). Financièrement, vu les coûts d'installation électrique (prises, panneaux) et d'une génératrice, les frais de charge de la voiture sont anecdotiques..sauf en cas de panne de courant si il faut la recharger à une borne extérieure (+300 à +700%), qui fonctionne encore. Enfin un autre aspect auquel il faut penser dans le cas d'une utilisation bidirectionnelle continue : l'usure de la batterie. Au prix de la bagnole, tout son attrait provient de la durabilité de celle-ci. Perdre 10% de batterie sur 5 ans, ce n'est pas la même chose que perdre 10% par an. Il faudrait trouver les chiffres pour connaitre l'impact des cycles de charge-décharge partiels pour un max de 80%.
  15. @ashlol Je me doute que tu sais ce qu'est un secureboot, loin de moi l'idée de te faire un cours. C'est juste quand t'as une maj de noyau il faut refaire les modules (une explication ici en fr si ça intéresse) et le secure boot peut embêter le monde.
  16. L'idée c'est que dans le calcul global, tu auras l'impression de charger en heure creuse, et te dire que tu as 80kwh de puissance disponible en heure pleine. Mais avec les perte de charge au mieux tu gommes l'écart de prix entre heure pleine et heure creuse. https://www.fiches-auto.fr/articles-auto/voiture-electrique/s-2491-pertes-energetiques-et-recharge-pourquoi-et-combien-.php
  17. Petit avis personnel sur les sujets des forums: Matériel et Conseils d'achat Ordinateurs de bureau et Composants Ordinateurs portables Conseils d'achat --> A quoi sert conseil d'achat, vu que dans "ordi de bureau" et "ordis portables" on y trouve les demandes? --> Et pourquoi ne pas ajouter domotique/équipement de la maison/appareils connectés? --> Et pourquoi ne pas faire revenir ici la partie "occasion"->"économie circulaire" Ajustement et personnalisation RAS je trouve Systèmes d'exploitation Windows (mobile) -> Windows tout court SVP Apple IOS et Mac OS --> RAS Ajouter Android GNU/Linux *BSD et dérivés d'unix Réseau et prog RAS Multimédia Je m'interroge sur le topic "mobilité" Par contre un topic "publications" (web, insta, youtube, tictoc et autres pour les conseils techniques et SEO) je le verrais bien Inpact café / vie du forum: à fusionner?
  18. On a bien galéré xD 1 an pour le smtp
  19. C'est le moins qu'on puisse dire, oui... Il faut que je refasse une petite passe en interne pour essayer d'enfin statuer sur les aspects liés à l'hébergement. Il faudrait aussi vérifier qu'on est correctement outillés pour limiter le spam, que la modération tourne pas à l'enfer. Et ensuite, si certains d'entre vous sont encore motivés (après tout ce temps, on peut comprendre que les bonnes volontés se soient émoussées), regarder comment faire un peu de ménage (genre virer tous les topics épinglés obsolètes déjà), et pourquoi pas créer ou renommer certaines catégories, à discuter.
  20. Yop (Alex de la rédaction Next), Je passe juste vous remercier d'avoir remis la machine sur pied !
  21. PC commandé, merci à tous pour vos conseils
  22. à mon avis c'est un dual link d'apparence (le connecteur a bien toutes les pins) mais à l'intérieur les 6 broches du milieu ne sont pas branchées donc en réalité c'est un single link même s'il est vendu comme dual link il y en a plein comme ça aussi sur amazon. C'est vrai pour d'autre connecteur comme le usb-c il y a plein de câble qui n'ont pas toutes les pins de branchées, j'ai d'ailleurs acheté un tester de câble usb-c pour vérifier mes câbles quand je les reçoit ou si j'ai un doute à un moment sur un câble. ça permet de faire des câbles moins cher car il y a des fils en moins et c'est invisible extérieurement donc on se fait avoir. Mais maintenant je ne me fais plus avoir enfin si, mais je teste et renvois si pas bon.
  23. oh et un indispensable idiot proof : timeshift, idéalement sur btrfs mais il peut se débrouiller avec rsync aussi Pour récupérer les catastrophes que pourraient causer les utilisateurs.
  24. 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)
  25. J'ai une SuperNote et mes collègues des Remarkable2. Point commun ? Après l'effet Waouh et quelques semaines, elles sont toutes placardées. Ce n'est pas si pratique que ça et nettement plus pénible à utiliser qu'un iPad+stylet. Beaucoup, dont moi-même, sommes revenus au bon vieux cahier papier ou laptop/Surface/iPad. Le défaut des eInk, c'est la partie logicielle et échange de données : à chier.
  26. Depuis que j'ai "perdu" dans un lac un Nikon F401 acheté la veille, je n'ai plus jamais acheté un appareil de ce niveau. C'était il y a (très) longtemps, mais la souffrance est toujours vive quand j'y pense 😂.
Ce classement est défini par rapport à Paris/GMT+02:00

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.