{"id":763,"date":"2018-07-13T09:54:12","date_gmt":"2018-07-13T07:54:12","guid":{"rendered":"https:\/\/www.tests-performance.fr\/?p=763"},"modified":"2018-07-25T13:51:58","modified_gmt":"2018-07-25T11:51:58","slug":"scripting-vugen-creation-et-utilisation-de-dll","status":"publish","type":"post","link":"https:\/\/www.tests-performance.fr\/?p=763","title":{"rendered":"Scripting Vugen 11.52- Cr\u00e9ation et utilisation de DLL"},"content":{"rendered":"<p dir=\"ltr\">Lorsque nous cr\u00e9ons une librairie .h dans\u00a0<span class=\"ephox-cram-annotation-wrap ephox-cram_478748657451531468408902\" aria-invalid=\"spelling\" data-ephox-cram-highlight-id=\"ephox-cram_478748657451531468408902\" data-ephox-cram-annotation=\"Vugen\" data-ephox-cram-lingo=\"fr\">Vugen<\/span>, nous aurons rapidement des probl\u00e8mes de performance lors de l&#8217;utilisation de celle-ci qui ne nous permettra pas d&#8217;atteindre \u00e0 terme l&#8217;exigence de transaction par seconde.<\/p>\n<p dir=\"ltr\">Pour augmenter la rapidit\u00e9 d&#8217;ex\u00e9cution de la librairie, la solution est de cr\u00e9er une\u00a0<span class=\"ephox-cram-annotation-wrap ephox-cram_261895308461531468409064\" aria-invalid=\"spelling\" data-ephox-cram-highlight-id=\"ephox-cram_261895308461531468409064\" data-ephox-cram-annotation=\"DLL\" data-ephox-cram-lingo=\"fr\">DLL<\/span>.<\/p>\n<p dir=\"ltr\">Les \u00e9tapes sont les suivantes :<\/p>\n<div dir=\"ltr\">1 &#8211; Cr\u00e9ation d&#8217;une DLL avec Visual C++ 2010 Express<\/div>\n<div dir=\"ltr\">2 &#8211; D\u00e9terminer les DLL d\u00e9pendantes \u00a0de la DLL \u00e0 cr\u00e9er avec MS dependency walker<\/div>\n<div dir=\"ltr\">3 &#8211; Cr\u00e9er le script\u00a0<span class=\"ephox-cram-annotation-wrap ephox-cram_957327003471531468409406\" aria-invalid=\"spelling\" data-ephox-cram-highlight-id=\"ephox-cram_957327003471531468409406\" data-ephox-cram-annotation=\"Vugen\" data-ephox-cram-lingo=\"fr\">Vugen<\/span>\u00a0afin que celui-ci charge correctement la\u00a0<span class=\"ephox-cram-annotation-wrap ephox-cram_265914984481531468409406\" aria-invalid=\"spelling\" data-ephox-cram-highlight-id=\"ephox-cram_265914984481531468409406\" data-ephox-cram-annotation=\"DLL\" data-ephox-cram-lingo=\"fr\">DLL<\/span>\u00a0lors d&#8217;un test unitaire et en charge<\/div>\n<p dir=\"ltr\"><strong><u><span class=\"ephox-cram-annotation-wrap ephox-cram_498507713491531468409406\" aria-invalid=\"spelling\" data-ephox-cram-highlight-id=\"ephox-cram_498507713491531468409406\" data-ephox-cram-annotation=\"Etape\" data-ephox-cram-lingo=\"fr\">Etape<\/span>\u00a01 : Configuration de\u00a0<span class=\"ephox-cram-annotation-wrap ephox-cram_643174597501531468409406\" aria-invalid=\"spelling\" data-ephox-cram-highlight-id=\"ephox-cram_643174597501531468409406\" data-ephox-cram-annotation=\"Visual\" data-ephox-cram-lingo=\"fr\">Visual<\/span>\u00a0C++ 2010 Express<\/u><\/strong><\/p>\n<p dir=\"ltr\"><span class=\"ephox-cram-annotation-wrap ephox-cram_85459461511531468409407\" aria-invalid=\"spelling\" data-ephox-cram-highlight-id=\"ephox-cram_85459461511531468409407\" data-ephox-cram-annotation=\"T\u00e9l\u00e9charger\" data-ephox-cram-lingo=\"fr\">T\u00e9l\u00e9charger<\/span>\u00a0et ex\u00e9cuter la version gratuite\u00a0<span class=\"ephox-cram-annotation-wrap ephox-cram_104291743521531468409407\" aria-invalid=\"spelling\" data-ephox-cram-highlight-id=\"ephox-cram_104291743521531468409407\" data-ephox-cram-annotation=\"Visual\" data-ephox-cram-lingo=\"fr\">Visual<\/span>\u00a0C++ 2010 Express<\/p>\n<p dir=\"ltr\" lang=\"\">Fichier\/Nouveau\/Projet\u00a0:<\/p>\n<p dir=\"ltr\" lang=\"\">\u00a0<img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/01.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/02.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/03.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/04.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/05.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/06.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\">Coller le code\u00a0:<\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/07.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\">Exemple complet de convertion Ebcdic\/Ascii : \u00a0<a href=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/ebdicascii.h\">ebdicascii.h<\/a> (Clic droit sur le fichier, enregistrer sous)<\/p>\n<p dir=\"ltr\" lang=\"\">Ajouter les lignes (dont les d\u00e9finition des fonctions utilis\u00e9es)\u00a0en d\u00e9but du code source (la librairie lrun.h est pr\u00e9sente dans l&#8217;installation de Vugen\/Analysis)\u00a0:<\/p>\n<p dir=\"ltr\" lang=\"\">\/\/ Librairie Loadrunner<\/p>\n<p dir=\"ltr\" lang=\"\"><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">#include<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0<\/span><span style=\"color: #a31515;\"><span style=\"font-family: Consolas, monospace;\">&#8220;C:\\CreatDLL\\lrun.h&#8221;<\/span><\/span><\/p>\n<p dir=\"ltr\"><span style=\"color: #008000;\"><span style=\"font-family: Consolas, monospace;\">\/\/ Compilation avec Visual C++ 2010 Express<\/span><\/span><\/p>\n<p dir=\"ltr\"><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">extern<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0<\/span><span style=\"color: #a31515;\"><span style=\"font-family: Consolas, monospace;\">&#8220;C&#8221;<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0<\/span><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">__declspec<\/span><\/span><span style=\"font-family: Consolas, monospace;\">(\u00a0<\/span><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">dllexport<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0)\u00a0<\/span><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">int<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0etoa(<\/span><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">char<\/span><\/span><span style=\"font-family: Consolas, monospace;\">* src,\u00a0<\/span><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">char<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0*lrvar);<\/span><\/p>\n<p dir=\"ltr\"><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">extern<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0<\/span><span style=\"color: #a31515;\"><span style=\"font-family: Consolas, monospace;\">&#8220;C&#8221;<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0<\/span><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">__declspec<\/span><\/span><span style=\"font-family: Consolas, monospace;\">(\u00a0<\/span><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">dllexport<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0)\u00a0<\/span><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">int<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0atoe(<\/span><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">char<\/span><\/span><span style=\"font-family: Consolas, monospace;\">* src,\u00a0<\/span><span style=\"color: #0000ff;\"><span style=\"font-family: Consolas, monospace;\">char<\/span><\/span><span style=\"font-family: Consolas, monospace;\">\u00a0*lrvar);<\/span><\/p>\n<p dir=\"ltr\" lang=\"\">Cr\u00e9er un r\u00e9pertoire C:\\CreatDLL qui contiendra toutes les librairies (DLL, lib, &#8230;). Ce r\u00e9pertoire devra \u00eatre pr\u00e9sent sur l&#8217;injecteur.<\/p>\n<p dir=\"ltr\" lang=\"\">Ajouter le chemin vers la lrun50.lib (cette librairie n&#8217;est pas pr\u00e9sente dans l&#8217;installation de Vugen\/Analysis, mais elle est pr\u00e9sente dans QTP), voici la V11 :\u00a0<a href=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/lrun50.zip\">lrun50.zip<\/a><\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/08.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/09.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\">Compiler\u00a0:<\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/10-1.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/11-1.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\">Copier la Dll dans C:\\CreatDLL.<\/p>\n<p dir=\"ltr\" lang=\"\"><strong><u>Etape 2 :\u00a0D\u00e9terminer les DLL d\u00e9pendantes \u00a0de la DLL \u00e0 cr\u00e9er avec MS dependency walker<\/u><\/strong><\/p>\n<p dir=\"ltr\" lang=\"\">Charger la Dll avec Dependency Walker :<\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/12-1.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\">Copier toutes les DLL manquantes dans C:\\CreatDLL<span style=\"color: #222222;\">\u00a0jusqu&#8217;\u00e0 ce qu&#8217;il n&#8217;y ait plus d&#8217;erreurs. (les DLL doivent toutes \u00eatre en 32 bits x86).<\/span><\/p>\n<p dir=\"ltr\" lang=\"\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/13-1.png\" \/><\/p>\n<p dir=\"ltr\" lang=\"\"><strong><u>Etape 3 : Cr\u00e9ation d&#8217;un script utilisant la DLL<\/u><\/strong><\/p>\n<p dir=\"ltr\"><span lang=\"\">Dans un script Vugen (Web Html\/Http), ajouter les lignes suivantes (en commen\u00e7ant par les DLL d\u00e9pendantes puis notre dll cr\u00e9\u00e9e).<\/span><\/p>\n<p dir=\"ltr\"><span style=\"color: #191970;\"><b>Action<\/b><\/span><span style=\"color: #000000;\">()<\/span><\/p>\n<p dir=\"ltr\"><span style=\"color: #000000;\">{<\/span><\/p>\n<p dir=\"ltr\">\u00a0 \u00a0\u00a0<span style=\"color: #e65700;\">lr_load_dll<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;C:\\\\CreatDLL\\\\IEShims.dll&#8221;<\/span><span style=\"color: #000000;\">);<\/span><br \/>\n<span style=\"color: #e65700;\">lr_load_dll<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;C:\\\\CreatDLL\\\\msvcr100d.dll&#8221;<\/span><span style=\"color: #000000;\">);<\/span><br \/>\n<span style=\"color: #e65700;\">lr_load_dll<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;C:\\\\CreatDLL\\\\shlwapi.dll&#8221;<\/span><span style=\"color: #000000;\">);<\/span><br \/>\n<span style=\"color: #e65700;\">lr_load_dll<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;C:\\\\CreatDLL\\\\sysntfy.dll&#8221;<\/span><span style=\"color: #000000;\">);<\/span><br \/>\n<span style=\"color: #e65700;\">lr_load_dll<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;C:\\\\CreatDLL\\\\ebcdicascii.dll&#8221;<\/span><span style=\"color: #000000;\">);<\/span><\/p>\n<p dir=\"ltr\"><span style=\"color: #e65700;\">lr_start_transaction<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;EbcdicToAscii&#8221;<\/span><span style=\"color: #000000;\">);<\/span><br \/>\n<span style=\"color: #191970;\"><b>etoa<\/b><\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #e65700;\">lr_eval_string<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;{Ebcdic}&#8221;<\/span><span style=\"color: #000000;\">),<\/span>\u00a0<span style=\"color: #008080;\">&#8220;Ascii&#8221;<\/span>\u00a0<span style=\"color: #000000;\">);<\/span><br \/>\n<span style=\"color: #e65700;\">lr_end_transaction<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;EbcdicToAscii&#8221;<\/span><span style=\"color: #000000;\">,<\/span><span style=\"color: #0000ff;\"><b>LR_AUTO<\/b><\/span><span style=\"color: #000000;\">);<\/span><\/p>\n<p><span style=\"color: #e65700;\">lr_output_message<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;Resultat Ascii: %s&#8221;<\/span><span style=\"color: #000000;\">,<\/span>\u00a0<span style=\"color: #e65700;\">lr_eval_string<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;{Ascii}&#8221;<\/span><span style=\"color: #000000;\">)<\/span>\u00a0<span style=\"color: #000000;\">);<\/span><\/p>\n<p><span style=\"color: #e65700;\">lr_start_transaction<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;AsciiToEbcdic&#8221;<\/span><span style=\"color: #000000;\">);<\/span><br \/>\n<span style=\"color: #191970;\"><b>atoe<\/b><\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #e65700;\">lr_eval_string<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;{Ascii}&#8221;<\/span><span style=\"color: #000000;\">),<\/span>\u00a0<span style=\"color: #008080;\">&#8220;Ebcdic&#8221;<\/span><span style=\"color: #000000;\">);<\/span><br \/>\n<span style=\"color: #e65700;\">lr_end_transaction<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;AsciiToEbcdic&#8221;<\/span><span style=\"color: #000000;\">,<\/span><span style=\"color: #0000ff;\"><b>LR_AUTO<\/b><\/span><span style=\"color: #000000;\">);<\/span><\/p>\n<p><span style=\"color: #e65700;\">lr_output_message<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;Resultat Ebcdic: %s&#8221;<\/span><span style=\"color: #000000;\">,<\/span>\u00a0<span style=\"color: #e65700;\">lr_eval_string<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #008080;\">&#8220;{Ebcdic}&#8221;<\/span><span style=\"color: #000000;\">)<\/span>\u00a0<span style=\"color: #000000;\">);<\/span><\/p>\n<p><span style=\"color: #0000ff;\">return<\/span>\u00a0<span style=\"color: #006c36;\">0<\/span><span style=\"color: #000000;\">;<\/span><br \/>\n<span style=\"color: #000000;\">}<\/span><\/p>\n<p dir=\"ltr\"><u><strong><span style=\"color: #000000;\">R\u00e9sultat\u00a0:\u00a0<\/span><\/strong><\/u><\/p>\n<p dir=\"ltr\"><span style=\"color: #000000;\"><img decoding=\"async\" src=\"https:\/\/www.tests-performance.fr\/wp-content\/uploads\/2018\/07\/14-1.png\" \/><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lorsque nous cr\u00e9ons une librairie .h dans\u00a0Vugen, nous aurons rapidement des probl\u00e8mes de performance lors de l&#8217;utilisation de celle-ci qui ne nous permettra pas d&#8217;atteindre \u00e0 terme l&#8217;exigence de transaction par seconde. Pour augmenter la rapidit\u00e9 d&#8217;ex\u00e9cution de la librairie, la solution est de cr\u00e9er une\u00a0DLL. Les \u00e9tapes sont les suivantes : 1 &#8211; Cr\u00e9ation [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[21],"tags":[27],"class_list":["post-763","post","type-post","status-publish","format-standard","hentry","category-vugen","tag-tests-de-performance"],"acf":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/posts\/763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=763"}],"version-history":[{"count":15,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/posts\/763\/revisions"}],"predecessor-version":[{"id":1176,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=\/wp\/v2\/posts\/763\/revisions\/1176"}],"wp:attachment":[{"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tests-performance.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}