IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Discussion :

Bricolage au coeur de Windows


Sujet :

Windows

  1. #1
    Inactif Avatar de Hibou57
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    852
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 852
    Points : 493
    Points
    493
    Par défaut Bricolage au coeur de Windows
    Remarque préalable à ce post. Je pensais initialement poster ce sujet dans le forum système/windows, mais comme il est organisé par version de windows, et ne comporte pas d'entrées pour le système windows en général, je post ce sujet, à défaut, dans developpement/windows.

    Je cite un extrait d'un long article, que vous pouvez lire en intégralité ici : http://www.joelonsoftware.com/articles/APIWar.html

    Citation Envoyé par APIWar.html
    I first heard about this from one of the developers of the hit game SimCity, who told me that there was a critical bug in his application: it used memory right after freeing it, a major no-no that happened to work OK on DOS but would not work under Windows where memory that is freed is likely to be snatched up by another running application right away. The testers on the Windows team were going through various popular applications, testing them to make sure they worked OK, but SimCity kept crashing. They reported this to the Windows developers, who disassembled SimCity, stepped through it in a debugger, found the bug, and added special code that checked if SimCity was running, and if it did, ran the memory allocator in a special mode in which you could still use memory after freeing it.
    (c'est moi qui souligne).

    Je résume, en français, pour ceux/celles qui ne lisent pas l'anglais. Un jeux, SimCity, qui fonctionnait bien sous DOS, s'avérait ne plus fonctionner sous Windows, dut-à un bug qui le faisait utiliser des zones des mémoires aprés les avoir libéré (sous DOS, mono-tâche, ça ne posait pas de problème.. mais sous Windows, le bug s'exprimait pleinement en faisant cracher l'application). Plutôt de corriger le bug (SimCity était une application phare, et windows ne pouvait pas s'en passer, car un OS se vend surtout pour les applications qu'il execute), plutôt que de corriger le bug de SimCity, une fonction spécial à été ajouté à Windows, pour que windows detecte l'execution de SimCity, et pour que dans cette circonstance, Windows passe dans un mode de gestion spéciale de la mémoire, autorisant l'utilisation de zones de mémoires pourtant libérées!

    Je suppose qu'il y en a d'autres... mais j'avais envie de vous en faire part.

    N.B. Je ne jête pour autant pas la pierre à Windows, parce qu'au moins, Windows, il marche lui ... concrêtement .... hummm...
    ------------------------------------------------------------
    Sur le web, c'est la liberté qui est gratuite, mais bien évidement pas la consomation ... et encore moins la consomation à outrance
    ------------------------------------------------------------
    Language shapes the way we think, and determines what we can think about [ B. Lee Whorf ] ... mais ce n'est pas tout à fait vrai à 100%...
    ------------------------------------------------------------
    Pascal (FreePascal?) - Ada (Gnat-3.15p)
    XSLT (XSLTProc) - CGI binaires (Ada/C) [ Clavier Arabe ]
    ------------------------------------------------------------

  2. #2
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Ils ont fait ça dans quel Windows?
    Déjà, vu que ça s'applique sur un programme DOS, cela ne peut avoir été gardé dans WinNT...
    Donc, ils ont sans doute fait ça dans Win16, reste à savoir si c'était toujours actif dans Win32...

    Sinon, ton article me fait penser à ceci (Framework .Net)
    http://msdn.microsoft.com/msdnmag/is...aspx?side=true
    Citation Envoyé par MSDN
    All the changes involved with renaming the section would have taken so long that we would have had to significantly slip the release date of Visual Studio 2005 and SQL Server 2005. Then one of our team members proposed an alternate solution that, if implemented, may have gone down in history as one of the ugliest hacks ever: rather than rename the section so that the validation code no longer failed on it, hack the String.StartsWith method so that it in this specific situation it lied and returned false rather than true. We would detect that the application had just called "configProtectedData".StartsWith("config") and return false. We even designed a series of optimization to make this check impact other applications as little as possible:
    Code C# ? : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    if (result == true && input.Length == 6 && this.Length == 19 &&
        this.Equals("configProtectedData") &&
        MethodInfo.GetCurrentMethod().Name.Equals("VerifySectionName"))
    {
        return false;
    }
    Là aussi, c'est moi qui souligne.
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  3. #3
    Inactif Avatar de Hibou57
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    852
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 852
    Points : 493
    Points
    493
    Par défaut
    J'en avais une bien croustillante aussi, mais je l'ai perdu.... c'était un bout de code de l'API, qui tentait d'appeler plusieurs fois une fonction dans une boucle, pour voir si ça marche (l'appel direct fonctionnait une fois sur 10, pour raisons inconnues)... au petit bonheur de la chance.

    Une chose à savoir quand même : c'est toujours une erreur de se reposer sur de telles informations pour la conception d'une application, parce que la compatibilité ascendante (d'ailleurs récement abandonné avec windows longhorm), ne s'applique pas à ces aspects non documentés de windows.
    ------------------------------------------------------------
    Sur le web, c'est la liberté qui est gratuite, mais bien évidement pas la consomation ... et encore moins la consomation à outrance
    ------------------------------------------------------------
    Language shapes the way we think, and determines what we can think about [ B. Lee Whorf ] ... mais ce n'est pas tout à fait vrai à 100%...
    ------------------------------------------------------------
    Pascal (FreePascal?) - Ada (Gnat-3.15p)
    XSLT (XSLTProc) - CGI binaires (Ada/C) [ Clavier Arabe ]
    ------------------------------------------------------------

Discussions similaires

  1. Réponses: 1
    Dernier message: 22/10/2013, 12h04
  2. Windows et les multi-coeurs
    Par set991 dans le forum Windows
    Réponses: 2
    Dernier message: 20/03/2012, 11h04
  3. Réponses: 6
    Dernier message: 31/08/2011, 16h30
  4. Installation Windows avec double coeur
    Par helios77 dans le forum Composants
    Réponses: 4
    Dernier message: 18/07/2008, 09h24
  5. Réponses: 4
    Dernier message: 07/06/2007, 17h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo