Check_SharedMemory_dll

Author: Copyright � Zhunko
0 Views
0 Downloads
0 Favorites
Check_SharedMemory_dll
//+--------------------------------------------------------------------------------------------+
//|                                                               Check_SharedMemory.dll.mq4   |
//|                                                               Copyright © Zhunko           |
//| 30.03.2010 - 09.02.2014                                       vadim@zhunko.ru              |
//+--------------------------------------------------------------------------------------------+
//| Â ýòîì ôàéëå íå ðàöèîíàëüíî áûëî ïîêàçàòü òåñòû ïî êàæäîé ôóíêöèè â îòäåëüíîñòè.           |
//| Íàäî áûëî ñäåëàòü íàãëÿäíîñòü òåñòîâ ñ èç ïðîñòîòîé è îõâàòèòü âñå ôóíêöèè. Ïî ýòîìó       |
//| ïîëüçóéòåñü ïîèñêîì â ýòîì ôàéëå ïðè íåîáõîäèìîñòè ïîñìîòðåòü ïðèìåð ïî êîíêðåòíîé ôóíêöèè.|
//+--------------------------------------------------------------------------------------------+
#property copyright "Copyright © Zhunko"
#property link      "vadim@zhunko.ru"
#property script_show_inputs
#property strict
#include <SharedMemory.mqh> // Çàãîëîâî÷íûé ôàéë áèáëèîòåêè "SharedMemory.dll".
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
// Èäåíòèôèêàòîðû îáëàñòåé ïàìÿòè.                      //
input int    Area            = 0;                       // Îáëàñòü ïàìÿòè: MEMORY_GLOBAL   0  Ãëîáàëüíàÿ îáëàñòü ïàìÿòè.
                                                        //                 MEMORY_TERMINAL 1  Îáëàñòü ïàìÿòè òåðìèíàëà.
                                                        //                 MEMORY_WINDOW   2  Îáëàñòü ïàìÿòè îêíà.
input string InitPrefix      = "";                      // Ïðåôèêñ äëÿ èìåíè îáëàñòè ïàìÿòè ïîëüçîâàòåëüñêèõ êëàññîâ. Ò.å. äîïîëíèòåëüíîå 
// Òåñòû èçìåíèÿ ðåçåðâèðîâàíèÿ ïîëüçîâàòåëüñêèõ êëàññîâ.
input int    UserGlobal      =  25;                     // Íîâîå ìàêñèìàëüíîå êîëè÷åñòâî êëàññîâ ïîëüçîâàòåëÿ â ãëîáàëüíîé îáëàñòè ïàìÿòè.
input int    UserTerminal    =  50;                     // Íîâîå ìàêñèìàëüíîå êîëè÷åñòâî êëàññîâ ïîëüçîâàòåëÿ â îáëàñòè ïàìÿòè òåðìèíàëà.
input int    UserWindow      = 100;                     // Íîâîå ìàêñèìàëüíîå êîëè÷åñòâî êëàññîâ ïîëüçîâàòåëÿ â îáëàñòè ïàìÿòè îêíà.
// Âêëþ÷àòåëè îñíîâíûõ òåñòîâ.
input bool   CheckWriteRead  = false;                   // Êîíòðîëü çàïèñè/÷òåíèÿ â îäíîì ïðîöåññå. Ò.å. â îäíîì ÌÒ4. Èç ãðàôèêà â äðóãîé ãðàôèê èëè íà îäíîì ãðàôèêå.
input bool   CheckWrite      = false;                   // Êîíòðîëü çàïèñè â ðàçíûõ ïðîöåññàõ. Ò.å. çàïèñûâàåì â îäíîì ÌÒ4, ÷èòàåì â äðóãîì ÌÒ4.
input bool   CheckRead       = false;                   // Êîíòðîëü ÷òåíèÿ â ðàçíûõ ïðîöåññàõ. Ò.å. ÷èòàåì, òî, ÷òî çàïèñàíî â äðóãîì ÌÒ4.
input bool   CheckGeneral    = false;                   // Êîíòðîëü îñíîâíûõ ôóíêöèé.
input bool   CheckProjection = false;                   // Êîíòðîëü îñíîâíûõ ôóíêöèé ïðè íàëè÷èè ïðîåêöèè â òåêóùèé ïðîöåññ.
input bool   CheckClose      = false;                   // Êîíòðîëü çàêðûòèÿ ôàéëîâîãî îòîáðàæåíèÿ â äðóãîì ïðîöåññå.
// Èìåíà ïîëüçîâàòåëüñêîé ïàìÿòè.
input string NamePrefix      = "Check";                 // Ïðåôèêñ èìåíè ïðîåöèðóåìîãî ôàéëà äëÿ çàêðûòèÿ ïî ïðåôèêñó èìåíè.
input string NameMemory0     = "CheckMemory0";          // Èìÿ äëÿ ïðîåöèðóåìîãî ôàéëà. Äîïîëíèòåëüíûå ïðåôèêñû äëÿ ïðîñòðàíñòâà èì¸í: "Global\" èëè "Local\".
input string NameMemory1     = "CheckMemory1";          // Èìÿ äëÿ ïðîåöèðóåìîãî ôàéëà.
input string NameMemory2     = "CheckMemory2";          // Èìÿ äëÿ ïðîåöèðóåìîãî ôàéëà.
input string NameMemory3     = "CheckMemory3";          // Èìÿ äëÿ ïðîåöèðóåìîãî ôàéëà.
input string NameMemory4     = "Memory4";               // Èìÿ äëÿ ïðîåöèðóåìîãî ôàéëà.
// Ïàðàìåòðû ïàìÿòè.
input int    Index           = -1;                      // Èíäåêñ îáëàñòè ïàìÿòè ïîëüçîâàòåëÿ.
input int    StartByte       = 0;                       // Íîìåð áàéòà îò íà÷àëà âûäåëåííîé ïàìÿòè, ñ êîòîðîãî áóäóò çàïèñàíû äàííûå.
input int    MemorySize      = 64000;                   // Êîëè÷åñòâî ðåçåðâèðóåìîé ïàìÿòè äëÿ ôàéëîâîãî îòáðàæåíèÿ.
// Ïåðåìåííûå äëÿ çàïèñè.
input bool   bValue          = true;                    // ×èñëî òèïà BOOL. 
input char   cValue          = 123;                     // ×èñëî òèïà CHAR.
input uchar  ucValue         = 255;                     // ×èñëî òèïà UNSIGNED CHAR.
input short  shValue         = 32100;                   // ×èñëî òèïà SHORT.
input ushort ushValue        = 65535;                   // ×èñëî òèïà UNSIGNED SHORT.
input int    nValue          = 2147012345;              // ×èñëî òèïà INT.
input uint   uiValue         = 4294967295;              // ×èñëî òèïà UNSIGNED INT.
input long   lValue          = 9223372036854775807;     // ×èñëî òèïà LONG.
input ulong  ulValue         = 18446744073709551615;    // ×èñëî òèïà UNSIGNED LONG.
input float  fValue          = 1234.5;                  // ×èñëî òèïà FLOAT.
input double dValue          = 1234.56789012;           // ×èñëî òèïà DOUBLE.
input string sValue0         = "Êîíòðîëü = 1234.56789"; // Ñòðîêà òèïà STRING.
input string sValue1         = "Êîíòðîëü = 9876.54321"; // Ñòðîêà òèïà STRING.
input string sValue2         = "Ïðèâåò ìèð!!!";         // Ñòðîêà òèïà STRING.
input string sValue3         = "Ìèðó ìèð!";             // Ñòðîêà òèïà STRING.
input string sValue4         = "Íåïðàâèëüíîå  èìÿ";     // Ñòðîêà òèïà STRING.
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
void OnStart()
 {
  int    i = 0;
  size_t stAddress = NULL;
  int    hMapping = NULL;
  int    hMapping1 = NULL;
  int    hMapping2 = NULL;
  int    hMapping3 = NULL;
  int    hMapping4 = NULL;
  int    nAdr = 0; // Àäðåñ çàïèñè â ïàìÿòü.
  int    nSize0 = StringLen(sValue0);
  int    nSize1 = StringLen(sValue1);
  int    nSize2 = StringLen(sValue2);
  int    nSize3 = StringLen(sValue3);
  int    nSize4 = StringLen(sValue4);
  string sComment = "";
  string sHandleWindow = string(ChartGetInteger(ChartID(), CHART_WINDOW_HANDLE));
  string sPrefix = "";
  // Ìàññèâû äëÿ çàïèñè.
  bool   abOutArray[10] = {true, false, true, false, true, true, true, false, false, false};
  char   acOutArray[10] = {-128, -93, -70, -25, 0, 25, 56, 86, 96, 127};
  uchar  aucOutArray[10] = {0, 54, 75, 123, 150, 175, 199, 210, 230, 255};
  short  ashOutArray[10] = {-32768, -22210, -16789, -8765, 0, 4567, 8907, 16789, 22456, 32767};
  ushort aushOutArray[10] = {0, 1210, 3789, 4765, 50764, 12567, 18907, 35789, 45456, 65535};
  int    aiOutArray[10] = {-2147483648, -1147432001, -16789, -8765, 0, 4567, 8907, 16789, 1147432001, 2147483647};
  uint   auiOutArray[10] = {0, 4567, 8907, 16789, 65535, 130535, 2600535, 1147432001, 2147483647, 4294967295};
  long   alOutArray[10] = {-9223372036854775808, -4294967295, -16789, -8765, 0, 4567, 8907, 16789, 4294967295, 9223372036854775807};
  ulong  aulOutArray[10] = {0, 4567, 8907, 16789, 1147432001, 2147483647, 4294967295, 8294967295, 9223372036854775807, 18446744073709551615};
  float  afOutArray[10] = {-21474.3200112345, -11474.3200112345, -16.78912345, -876.512345, 0, 45671.2345612345, 890712.345678912, 167891.234567891, 1147432.00112345, 214743.200112345};
  double adOutArray[10] = {-21474.3200112345, -11474.3200112345, -16.78912345, -876.512345, 0, 45671.2345612345, 890712.345678912, 167891.234567891, 1147432.00112345, 214743.200112345};
  // Ìàññèâû äëÿ ÷òåíèÿ.
  bool   abIncArray[10] = {0};
  char   acIncArray[10] = {0};
  uchar  aucIncArray[10] = {0};
  short  ashIncArray[10] = {0};
  ushort aushIncArray[10] = {0};
  int    aiIncArray[10] = {0};
  uint   auiIncArray[10] = {0};
  long   alIncArray[10] = {0};
  ulong  aulIncArray[10] = {0};
  float  afIncArray[10] = {0};
  double adIncArray[10] = {0};
  //xxxx Ôîðìèðîâàíèå çàãîëîâêà êîììåòàðèåâ. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  switch(Area)
   {
    case MEMORY_GLOBAL:   sComment = "Ãëîáàëüíàÿ îáëàñòü ïàìÿòè: MEMORY_GLOBAL\n\n"; break;
    case MEMORY_TERMINAL: sComment = "Îáëàñòü ïàìÿòè òåðìèíàëà: MEMORY_TERMINAL\n\n"; break;
    case MEMORY_WINDOW:   sComment = "Îáëàñòü ïàìÿòè îêíà: MEMORY_WINDOW\n\n"; break;
   }
  //xxxx Ôîðìèðîâàíèå ïðåôèêñà äëÿ îáëàñòè ïàìÿòè îêíà. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  if (Area == MEMORY_WINDOW)
   {// Äëÿ ðàáîòû â îäíîì ãðàôèêå ýòî íåîáõîäèìî! Íàäî äîáàâèòü 
    if (InitPrefix == "") sPrefix = sHandleWindow;
    else sPrefix = sHandleWindow + "." + InitPrefix;
   }
  //xxxx Èíèöèàëèçàöèÿ áèáëèîòåêè. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  MemoryInit(UserGlobal, UserTerminal, UserWindow);
  //xxxx Êîíòðîëü çàïèñè/÷òåíèÿ â îäíîì ïðîöåññå. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  if (CheckWriteRead)
   {//==== Ñîçäàíèå ôàéëîâîãî îòîáðàæåíèÿ. ===============================================================================================================================================================================================
    hMapping = MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory0, MemorySize); // Ñîçäà¸ì îòîáðàæåíèå.
    sComment = sComment + "Îòîáðàæåíèå \"" + NameMemory0 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(hMapping) + "\n\n";
    Comment(sComment);
//    hMapping = MemoryOpenW(Area, sPrefix, Index, NameMemory0); // Îòêðûâàåì óæå ñîçäàííîå. Ïîëó÷àåì íîâûé äåñêðèïòîð.
//    sComment = sComment + "Îòîáðàæåíèå \"" + NameMemory0 + "\" îòêðûòî. Äåñêðèïòîð: " + hMapping + "\n\n";
//    Comment(sComment);
    //==== Êîíòðîëü çàïèñè/÷òåíèÿ ÷èñåë è ñòðîê. =========================================================================================================================================================================================
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà BOOL: (" + string(MemoryWriteBoolW(Area, sPrefix, Index, NameMemory0, StartByte, bValue)) + ")  " + string(bValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà BOOL:             " + string(MemoryReadBoolW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà CHAR: (" + string(MemoryWriteCharW(Area, sPrefix, Index, NameMemory0, StartByte, cValue)) + ")  " + string(cValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà CHAR:             " + string(MemoryReadCharW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà UNSIGNED CHAR: (" + string(MemoryWriteUCharW(Area, sPrefix, Index, NameMemory0, StartByte, ucValue)) + ")  " + string(ucValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà UNSIGNED CHAR:             " + string(MemoryReadUCharW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà SHORT: (" + string(MemoryWriteShortW(Area, sPrefix, Index, NameMemory0, StartByte, shValue)) + ")  " + string(shValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà SHORT:             " + string(MemoryReadShortW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà UNSIGNED SHORT: (" + string(MemoryWriteUShortW(Area, sPrefix, Index, NameMemory0, StartByte, ushValue)) + ")  " + string(ushValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà UNSIGNED SHORT:             " + string(MemoryReadUShortW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà INT: (" + string(MemoryWriteIntW(Area, sPrefix, Index, NameMemory0, StartByte, nValue)) + ")  " + string(nValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà INT:             " + string(MemoryReadIntW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà UNSIGNED INT: (" + string(MemoryWriteUIntW(Area, sPrefix, Index, NameMemory0, StartByte, uiValue)) + ")  " + string(uiValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà UNSIGNED INT:             " + string(MemoryReadUIntW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà LONG: (" + string(MemoryWriteLongW(Area, sPrefix, Index, NameMemory0, StartByte, lValue)) + ")  " + string(lValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà LONG:             " + string(MemoryReadLongW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà UNSIGNED LONG: (" + string(MemoryWriteULongW(Area, sPrefix, Index, NameMemory0, StartByte, ulValue)) + ")  " + string(ulValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà UNSIGNED LONG:             " + string(MemoryReadULongW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà FLOAT: (" + string(MemoryWriteFloatW(Area, sPrefix, Index, NameMemory0, StartByte, fValue)) + ")  " + string(fValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà FLOAT:             " + string(MemoryReadFloatW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà DOUBLE: (" + string(MemoryWriteDoubleW(Area, sPrefix, Index, NameMemory0, StartByte, dValue)) + ")  " + string(dValue) + "\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ÷èñëî òèïà DOUBLE:             " + string(MemoryReadDoubleW(Area, sPrefix, Index, NameMemory0, StartByte)) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ñòðîêó òèïà STRING (ANSI): (" + string(MemoryWriteStringUnicodeToAnsiW(Area, InitPrefix, Index, NameMemory0, StartByte, sValue0)) + ")  \"" + sValue0 + "\"\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING (ANSI):             \"" + string(MemoryReadStringAnsiToUnicodeW(Area, InitPrefix, Index, NameMemory0, StartByte, nSize0)) + "\"\n\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ñòðîêó òèïà STRING (UNICODE): (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory0, StartByte, sValue1)) + ")  \"" + sValue1 + "\"\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING (UNICODE):             \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory0, StartByte, nSize1)) + "\"\n\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //==== Êîíòðîëü çàïèñè/÷òåíèÿ ìàññèâîâ. ==============================================================================================================================================================================================
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà BOOL: (" + string(MemoryWriteBoolArrayW(Area, sPrefix, Index, NameMemory0, StartByte, abOutArray, ArraySize(abOutArray), 0, ArraySize(abOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(abOutArray[i]) + ", ";
      else sComment = sComment + string(abOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà BOOL: (" + string(MemoryReadBoolArrayW(Area, sPrefix, Index, NameMemory0, StartByte, abIncArray, ArraySize(abIncArray), 0, ArraySize(abOutArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(abIncArray[i]) + ", ";
      else sComment = sComment + string(abIncArray[i]) + "}\n";
     }
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà CHAR: (" + string(MemoryWriteCharArrayW(Area, sPrefix, Index, NameMemory0, StartByte, acOutArray, ArraySize(acOutArray), 0, ArraySize(acOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(acOutArray[i]) + ", ";
      else sComment = sComment + string(acOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà CHAR: (" + string(MemoryReadCharArrayW(Area, sPrefix, Index, NameMemory0, StartByte, acIncArray, ArraySize(acIncArray), 0, ArraySize(acIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(acIncArray[i]) + ", ";
      else sComment = sComment + string(acIncArray[i]) + "}\n";
     }
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà UNSIGNED CHAR: (" + string(MemoryWriteUCharArrayW(Area, sPrefix, Index, NameMemory0, StartByte, aucOutArray, ArraySize(aucOutArray), 0, ArraySize(aucOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aucOutArray[i]) + ", ";
      else sComment = sComment + string(aucOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà UNSIGNED CHAR: (" + string(MemoryReadUCharArrayW(Area, sPrefix, Index, NameMemory0, StartByte, aucIncArray, ArraySize(aucIncArray), 0, ArraySize(aucIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aucIncArray[i]) + ", ";
      else sComment = sComment + string(aucIncArray[i]) + "}\n";
     }
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà SHORT: (" + string(MemoryWriteShortArrayW(Area, sPrefix, Index, NameMemory0, StartByte, ashOutArray, ArraySize(ashOutArray), 0, ArraySize(ashOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(ashOutArray[i]) + ", ";
      else sComment = sComment + string(ashOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà SHORT: (" + string(MemoryReadShortArrayW(Area, sPrefix, Index, NameMemory0, StartByte, ashIncArray, ArraySize(ashIncArray), 0, ArraySize(ashIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(ashIncArray[i]) + ", ";
      else sComment = sComment + string(ashIncArray[i]) + "}\n";
     }
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà UNSIGNED SHORT: (" + string(MemoryWriteUShortArrayW(Area, sPrefix, Index, NameMemory0, StartByte, aushOutArray, ArraySize(aushOutArray), 0, ArraySize(aushOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aushOutArray[i]) + ", ";
      else sComment = sComment + string(aushOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà UNSIGNED SHORT: (" + string(MemoryReadUShortArrayW(Area, sPrefix, Index, NameMemory0, StartByte, aushIncArray, ArraySize(aushIncArray), 0, ArraySize(aushIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aushIncArray[i]) + ", ";
      else sComment = sComment + string(aushIncArray[i]) + "}\n";
     }
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà INT: (" + string(MemoryWriteIntArrayW(Area, sPrefix, Index, NameMemory0, StartByte, aiOutArray, ArraySize(aiOutArray), 0, ArraySize(aiOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aiOutArray[i]) + ", ";
      else sComment = sComment + string(aiOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà INT: (" + string(MemoryReadIntArrayW(Area, sPrefix, Index, NameMemory0, StartByte, aiIncArray, ArraySize(aiIncArray), 0, ArraySize(aiIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aiIncArray[i]) + ", ";
      else sComment = sComment + string(aiIncArray[i]) + "}\n";
     }
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà UNSIGNED INT: (" + string(MemoryWriteUIntArrayW(Area, sPrefix, Index, NameMemory0, StartByte, auiOutArray, ArraySize(auiOutArray), 0, ArraySize(auiOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(auiOutArray[i]) + ", ";
      else sComment = sComment + string(auiOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà UNSIGNED INT: (" + string(MemoryReadUIntArrayW(Area, sPrefix, Index, NameMemory0, StartByte, auiIncArray, ArraySize(auiIncArray), 0, ArraySize(auiIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(auiIncArray[i]) + ", ";
      else sComment = sComment + string(auiIncArray[i]) + "}\n";
     }
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà LONG: (" + string(MemoryWriteLongArrayW(Area, sPrefix, Index, NameMemory0, StartByte, alOutArray, ArraySize(alOutArray), 0, ArraySize(alOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(alOutArray[i]) + ", ";
      else sComment = sComment + string(alOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà LONG: (" + string(MemoryReadLongArrayW(Area, sPrefix, Index, NameMemory0, StartByte, alIncArray, ArraySize(alIncArray), 0, ArraySize(alIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(alIncArray[i]) + ", ";
      else sComment = sComment + string(alIncArray[i]) + "}\n";
     }
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà UNSIGNED LONG: (" + string(MemoryWriteULongArrayW(Area, sPrefix, Index, NameMemory0, StartByte, aulOutArray, ArraySize(aulOutArray), 0, ArraySize(aulOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aulOutArray[i]) + ", ";
      else sComment = sComment + string(aulOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà UNSIGNED LONG: (" + string(MemoryReadULongArrayW(Area, sPrefix, Index, NameMemory0, StartByte, aulIncArray, ArraySize(aulIncArray), 0, ArraySize(aulIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aulIncArray[i]) + ", ";
      else sComment = sComment + string(aulIncArray[i]) + "}\n";
     }
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà FLOAT: (" + string(MemoryWriteFloatArrayW(Area, sPrefix, Index, NameMemory0, StartByte, afOutArray, ArraySize(afOutArray), 0, ArraySize(afOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(afOutArray[i]) + ", ";
      else sComment = sComment + string(afOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà FLOAT: (" + string(MemoryReadFloatArrayW(Area, sPrefix, Index, NameMemory0, StartByte, afIncArray, ArraySize(afIncArray), 0, ArraySize(afIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(afIncArray[i]) + ", ";
      else sComment = sComment + string(afIncArray[i]) + "}\n";
     }
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà DOUBLE: (" + string(MemoryWriteDoubleArrayW(Area, sPrefix, Index, NameMemory0, StartByte, adOutArray, ArraySize(adOutArray), 0, ArraySize(adOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(adOutArray[i]) + ", ";
      else sComment = sComment + string(adOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà DOUBLE: (" + string(MemoryReadDoubleArrayW(Area, sPrefix, Index, NameMemory0, StartByte, adIncArray, ArraySize(adIncArray), 0, ArraySize(adIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(adIncArray[i]) + ", ";
      else sComment = sComment + string(adIncArray[i]) + "}\n\n";
     }
    Comment(sComment);
    //==== Êîíòðîëü çàêðûòèÿ äåñêðèïòîðîâ. ===============================================================================================================================================================================================
    sComment = sComment + "Äåñêðèïòîð çàêðûò: (" + string(MemoryCloseHandleW(Area, sPrefix, hMapping)) + ")\n";
    Comment(sComment);
    sComment = sComment + "Êîíòðîëü çàêðûòèÿ. Ïîïûòêà îòêðûòü îòîáðàæåíèå. Äåñêðèïòîð: " + string(MemoryOpenW(Area, sPrefix, Index, NameMemory0)) + "\n\n"; // Îòêðûâàåòñÿ îêíî ñ ñîîáùåíèåì.
    Comment(sComment);
    // Çàêðûòèå åäèíñòâåííîãî äåñêðèïòîðà ïðèâåëî ê çàêðûòèþ ôàéëîâîãî îòîáðàæåíèÿ. Ôóíêöèÿ îòêðûòèÿ íå ìîæåò îòêðûòü íåñóùåñòâóþùåå ôàéëîâîå îòîáðàæåíèå.
   }
  //xxxx Ïèøåì îäèí ðàç. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  if (CheckWrite)
   {//==== Êîíòðîëü ñîçäàíèÿ ôàéëîâîãî îòîáðàæåíèÿ äëÿ ðàáîòû íà íèçêîì óðîâíå. ==========================================================================================================================================================
    stAddress = MemoryCreateProjectionW(Area, sPrefix, NULL, Index, NameMemory0, MemorySize);
    sComment = sComment + "Îòîáðàæåíèå \"" + NameMemory0 + "\" ñîçäàíî. Àäðåñ: " + string(stAddress) + "\n";
    Comment(sComment);
    sComment = sComment + "Ïîëó÷àåì ïîëíîå èìÿ ïî èíäåêñó 0: " + MemoryFullNameByIndexW(Area, sPrefix, 0) + "\n";
    Comment(sComment);
//    sComment = sComment + "Êîíòðîëü îòêðûòèÿ ñ îäèíàêîâûì èìåíåì. Àäðåñ: " + MemoryOpenProjectionW(Area, sPrefix, Index, NameMemory0) + "\n\n";
//    Comment(sComment);
    sComment = sComment + "Î÷èùàåì ïàìÿòü ïåðåä çàïèñüþ: " + string(MemoryClearW(Area, sPrefix, Index, NameMemory0)) + "\n"; // Äëÿ ÷èñëîâûõ çíà÷åíèé íå îáÿçàòåëüíî, íî äëÿ ñòðîê æåëàòåëüíî.
    Comment(sComment);
    //==== Êîíòðîëü çàïèñè íèçêîãî óðîâíÿ. ===============================================================================================================================================================================================
    nAdr = 0;
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà BOOL: ("              + string(MemoryWriteBoolW(Area, sPrefix, Index, NameMemory0, nAdr, bValue)) + ")  " + string(bValue) + "\n";
    nAdr++;
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà CHAR: ("              + string(MemoryWriteCharW(Area, sPrefix, Index, NameMemory0, nAdr, cValue)) + ")  " + string(cValue) + "\n";
    nAdr++;
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà UCHAR: ("             + string(MemoryWriteUCharW(Area, sPrefix, Index, NameMemory0, nAdr, ucValue)) + ")  " + string(ucValue) + "\n";
    nAdr++;
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà SHORT: ("             + string(MemoryWriteShortW(Area, sPrefix, Index, NameMemory0, nAdr, shValue)) + ")  " + string(shValue) + "\n";
    nAdr += 2;
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà USHORT: ("            + string(MemoryWriteUShortW(Area, sPrefix, Index, NameMemory0, nAdr, ushValue)) + ")  " + string(ushValue) + "\n";
    nAdr += 2;
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà INT: ("               + string(MemoryWriteIntW(Area, sPrefix, Index, NameMemory0, nAdr, nValue)) + ")  " + string(nValue) + "\n";
    nAdr += 4;
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà FLOAT: ("             + string(MemoryWriteFloatW(Area, sPrefix, Index, NameMemory0, nAdr, fValue)) + ")  " + string(fValue) + "\n";
    nAdr += 4;
    sComment = sComment + "Çàïèñûâàåì ÷èñëî òèïà DOUBLE: ("            + string(MemoryWriteDoubleW(Area, sPrefix, Index, NameMemory0, nAdr, dValue)) + ")  " + string(dValue) + "\n";
    nAdr += 8;
    sComment = sComment + "Çàïèñûâàåì ñòðîêó òèïà STRING (ANSI): ("    + string(MemoryWriteStringUnicodeToAnsiW(Area, sPrefix, Index, NameMemory0, nAdr, sValue0)) + ")  \"" + sValue0 + "\"\n";
    nAdr += nSize0;
    sComment = sComment + "Çàïèñûâàåì ñòðîêó òèïà STRING (UNICODE): (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory0, nAdr, sValue1)) + ")  \"" + sValue1 + "\"\n";
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    nAdr += 2 * nSize1; // Áûëà çàïèñàíà UNICODE-ñòðîêà. Îíà çàíèìàåò ïàìÿòü â äâà ðàçà áîëüøå ïàìÿòè.
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà BOOL: (" + string(MemoryWriteBoolArrayW(Area, sPrefix, Index, NameMemory0, nAdr, abOutArray, ArraySize(abOutArray), 0, ArraySize(abOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(abOutArray[i]) + ", ";
      else sComment = sComment + string(abOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    nAdr += 50;
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà CHAR: (" + string(MemoryWriteCharArrayW(Area, sPrefix, Index, NameMemory0, nAdr, acOutArray, ArraySize(acOutArray), 0, ArraySize(acOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(acOutArray[i]) + ", ";
      else sComment = sComment + string(acOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    nAdr += 50;
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà UNSIGNED CHAR: (" + string(MemoryWriteUCharArrayW(Area, sPrefix, Index, NameMemory0, nAdr, aucOutArray, ArraySize(aucOutArray), 0, ArraySize(aucOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aucOutArray[i]) + ", ";
      else sComment = sComment + string(aucOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    nAdr += 50;
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà SHORT: (" + string(MemoryWriteShortArrayW(Area, sPrefix, Index, NameMemory0, nAdr, ashOutArray, ArraySize(ashOutArray), 0, ArraySize(ashOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(ashOutArray[i]) + ", ";
      else sComment = sComment + string(ashOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    nAdr += 50;
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà UNSIGNED SHORT: (" + string(MemoryWriteUShortArrayW(Area, sPrefix, Index, NameMemory0, nAdr, aushOutArray, ArraySize(aushOutArray), 0, ArraySize(aushOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aushOutArray[i]) + ", ";
      else sComment = sComment + string(aushOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    nAdr += 50;
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà INT: (" + string(MemoryWriteIntArrayW(Area, sPrefix, Index, NameMemory0, nAdr, aiOutArray, ArraySize(aiOutArray), 0, ArraySize(aiOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aiOutArray[i]) + ", ";
      else sComment = sComment + string(aiOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    nAdr += 50;
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà FLOAT: (" + string(MemoryWriteFloatArrayW(Area, sPrefix, Index, NameMemory0, nAdr, afOutArray, ArraySize(afOutArray), 0, ArraySize(afOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(afOutArray[i]) + ", ";
      else sComment = sComment + string(afOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    nAdr += 50;
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà DOUBLE: (" + string(MemoryWriteDoubleArrayW(Area, sPrefix, Index, NameMemory0, nAdr, adOutArray, ArraySize(adOutArray), 0, ArraySize(adOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(adOutArray[i]) + ", ";
      else sComment = sComment + string(adOutArray[i]);
     }
    sComment = sComment + "}\n\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //==== Îòìåíà ïðåäñòàâëåíèÿ ïðîåöèðóåìîãî ôàéëà è çàêðûòèå äåñêðèïòîðîâ. =============================================================================================================================================================
    sComment = sComment + "Îòìåíÿåì ïðåäñòàâëåíèå ïðîåöèðóåìîãî ôàéëà: (" + string(MemoryUnProjectionW(Area, sPrefix, Index, "", stAddress)) + ")\n"; // Îòìåíèòü ïðîåêöèþ ìîæíî 3-ÿ ñïîñîáàìè.
//    sComment = sComment + "Îòìåíÿåì ïðåäñòàâëåíèå ïðîåöèðóåìîãî ôàéëà: (" + string(MemoryUnProjectionW(Area, sPrefix, Index, NameMemory0, NULL)) + ")\n";
    Comment(sComment);
   }
  //xxxx ×èòàåì â öèêëå, ÷òîáû ìîæíî áûëî îòñëåäèòü èçìåíåíèÿ ïàìÿòè. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  // Ïîêà ñêðèïò ðàáîòàåò, ìîæíî åãî çàïóñòèòü íà äðóãîì ãðàôèêå èëè â äðóãîì ÌÒ4, â çàâèñèìîñüè îò íàñòðîåê òåñòà, è èçìåíèòü ïàìÿòü çàïèñüþ. Ýòîò áëîê ïðî÷ò¸ò íîâûå äàííûå.
  if (CheckRead)
   {//==== Ñîçäà¸ì èëè îòêðûâàåì ïî èìåíè ôàéëîâîãî îòîáðàæåíèÿ. =========================================================================================================================================================================
//    stAddress = MemoryCreateProjectionW(Area, sPrefix, NULL, Index, NameMemory0, MemorySize);
//    sComment = sComment + "Îòêðûâàåì ïî èìåíè \"" + NameMemory0 + "\" ôàéëîâîãî îòîáðàæåíèÿ. Àäðåñ: " + string(stAddress) + "\n\n";
//    Comment(sComment);
    //==== Ñîçäàíèå ôàéëîâîãî îòîáðàæåíèÿ. ===============================================================================================================================================================================================
    hMapping = MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory0, MemorySize); // Ñîçäà¸ì îòîáðàæåíèå. Ìîæíî íå ñîçäàâàòü, à îòêðûòü. Íî òîãäà íåëüçÿ çàïóñòèòü ÷òåíèå ïåðåä çàïèñüþ.
    sComment = sComment + "Îòîáðàæåíèå \"" + NameMemory0 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(hMapping) + "\n";
    Comment(sComment);
    Sleep(3000);
    //==== Îòîáðàæàåì ïðåäñòàâëåíèå ïðîåöèðóåìîãî ôàéëà â àäðåñíîå ïðîñòðàíñòâî âûçûâàþùåãî ïðîöåññà. ====================================================================================================================================
//    stAddress = MemoryProjectionW(Area, sPrefix, hMapping);
//    sComment = sComment + "Îòîáðàæàåì â òåêóùèé ïðîöåññ ôàéëîâîå îòîáðàæåíèå \"" + NameMemory0 + "\". Àäðåñ: " + string(stAddress) + "\n\n";
//    Comment(sComment);
    while (CheckRead && !IsStopped())
     {//==== Èíèöèàëèçèðóåì ìàññèâû äëÿ ïðè¸ìà äàííûõ. ===================================================================================================================================================================================
      ArrayInitialize(abIncArray, 0);
      ArrayInitialize(acIncArray, 0);
      ArrayInitialize(aucIncArray, 0);
      ArrayInitialize(ashIncArray, 0);
      ArrayInitialize(aushIncArray, 0);
      ArrayInitialize(aiIncArray, 0);
      ArrayInitialize(afIncArray, 0);
      ArrayInitialize(adIncArray, 0);
      //==== Îòîáðàæàåì ïðåäñòàâëåíèå ïðîåöèðóåìîãî ôàéëà â àäðåñíîå ïðîñòðàíñòâî âûçûâàþùåãî ïðîöåññà. ==================================================================================================================================
      stAddress = MemoryProjectionByHandleW(Area, sPrefix, -1, hMapping);
      sComment = sComment + "Îòîáðàæàåì â òåêóùèé ïðîöåññ ôàéëîâîå îòîáðàæåíèå \"" + NameMemory0 + "\". Àäðåñ: " + string(stAddress) + "\n\n";
      Comment(sComment);
      //==== Êîíòðîëü ÷òåíèÿ íèçêîãî óðîâíÿ. =============================================================================================================================================================================================
      nAdr = 0;
      sComment = sComment + "×èòàåì ÷èñëî òèïà BOOL: "                + string(MemoryReadBoolW(Area, sPrefix, Index, NameMemory0, nAdr)) + "\n";
      nAdr++;
      sComment = sComment + "×èòàåì ÷èñëî òèïà CHAR: "                + string(MemoryReadCharW(Area, sPrefix, Index, NameMemory0, nAdr)) + "\n";
      nAdr++;
      sComment = sComment + "×èòàåì ÷èñëî òèïà UNSIGNED CHAR: "       + string(MemoryReadUCharW(Area, sPrefix, Index, NameMemory0, nAdr)) + "\n";
      nAdr++;
      sComment = sComment + "×èòàåì ÷èñëî òèïà SHORT: "               + string(MemoryReadShortW(Area, sPrefix, Index, NameMemory0, nAdr)) + "\n";
      nAdr += 2;
      sComment = sComment + "×èòàåì ÷èñëî òèïà UNSIGNED SHORT: "      + string(MemoryReadUShortW(Area, sPrefix, Index, NameMemory0, nAdr)) + "\n";
      nAdr += 2;
      sComment = sComment + "×èòàåì ÷èñëî òèïà INT: "                 + string(MemoryReadIntW(Area, sPrefix, Index, NameMemory0, nAdr)) + "\n";
      nAdr += 4;
      sComment = sComment + "×èòàåì ÷èñëî òèïà FLOAT: "               + string(MemoryReadFloatW(Area, sPrefix, Index, NameMemory0, nAdr)) + "\n";
      nAdr += 4;
      sComment = sComment + "×èòàåì ÷èñëî òèïà DOUBLE: "              + string(MemoryReadDoubleW(Area, sPrefix, Index, NameMemory0, nAdr)) + "\n";
      nAdr += 8;
      sComment = sComment + "×èòàåì ñòðîêó òèïà STRING (ANSI): \""    + string(MemoryReadStringAnsiToUnicodeW(Area, InitPrefix, Index, NameMemory0, nAdr, nSize0)) + "\"\n";
      nAdr += nSize0;
      sComment = sComment + "×èòàåì ñòðîêó òèïà STRING (UNICODE): \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory0, nAdr, nSize1)) + "\"\n";
      // Ìû íå çíàåì ïðè ÷òåíèè êàêàÿ äëèíà ó ñòðîêè. Ïðîñòî ÷èòàåì îòâåä¸ííîå ïîëå äëèííîé 50 ñèìâîëîâ. Ïîñëå ñòðîêè âîçìîæåí ìóñîð. Ïåðåä çàïèñüþ íàäî ïî÷èñòèòü ïàìÿòü.
      //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      nAdr += 2 * nSize1; // Áûëà ïðîî÷èòàíà UNICODE-ñòðîêà. Îíà çàíèìàåò ïàìÿòü â äâà ðàçà áîëüøå ïàìÿòè.
      sComment = sComment + "×èòàåì ìàññèâ òèïà BOOL: (" + string(MemoryReadBoolArrayW(Area, sPrefix, Index, NameMemory0, nAdr, abIncArray, ArraySize(abIncArray), 0, ArraySize(abIncArray))) + ")  {";
      for (i = 0; i < 10; i++)
       {
        if (i < 9) sComment = sComment + string(abIncArray[i]) + ", ";
        else sComment = sComment + string(abIncArray[i]);
       }
      sComment = sComment + "}\n";
      Comment(sComment);
      //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      nAdr += 50;
      sComment = sComment + "×èòàåì ìàññèâ òèïà CHAR: (" + string(MemoryReadCharArrayW(Area, sPrefix, Index, NameMemory0, nAdr, acIncArray, ArraySize(acIncArray), 0, ArraySize(acIncArray))) + ")  {";
      for (i = 0; i < 10; i++)
       {
        if (i < 9) sComment = sComment + string(acIncArray[i]) + ", ";
        else sComment = sComment + string(acIncArray[i]);
       }
      sComment = sComment + "}\n";
      Comment(sComment);
      //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      nAdr += 50;
      sComment = sComment + "×èòàåì ìàññèâ òèïà UNSIGNED CHAR: (" + string(MemoryReadUCharArrayW(Area, sPrefix, Index, NameMemory0, nAdr, aucIncArray, ArraySize(aucIncArray), 0, ArraySize(aucIncArray))) + ")  {";
      for (i = 0; i < 10; i++)
       {
        if (i < 9) sComment = sComment + string(aucIncArray[i]) + ", ";
        else sComment = sComment + string(aucIncArray[i]);
       }
      sComment = sComment + "}\n";
      Comment(sComment);
      //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      nAdr += 50;
      sComment = sComment + "×èòàåì ìàññèâ òèïà SHORT: (" + string(MemoryReadShortArrayW(Area, sPrefix, Index, NameMemory0, nAdr, ashIncArray, ArraySize(ashIncArray), 0, ArraySize(ashIncArray))) + ")  {";
      for (i = 0; i < 10; i++)
       {
        if (i < 9) sComment = sComment + string(ashIncArray[i]) + ", ";
        else sComment = sComment + string(ashIncArray[i]);
       }
      sComment = sComment + "}\n";
      Comment(sComment);
      //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      nAdr += 50;
      sComment = sComment + "×èòàåì ìàññèâ òèïà UNSIGNED SHORT: (" + string(MemoryReadUShortArrayW(Area, sPrefix, Index, NameMemory0, nAdr, aushIncArray, ArraySize(aushIncArray), 0, ArraySize(aushIncArray))) + ")  {";
      for (i = 0; i < 10; i++)
       {
        if (i < 9) sComment = sComment + string(aushIncArray[i]) + ", ";
        else sComment = sComment + string(aushIncArray[i]);
       }
      sComment = sComment + "}\n";
      Comment(sComment);
      //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      nAdr += 50;
      sComment = sComment + "×èòàåì ìàññèâ òèïà INT: (" + string(MemoryReadIntArrayW(Area, sPrefix, Index, NameMemory0, nAdr, aiIncArray, ArraySize(aiIncArray), 0, ArraySize(aiIncArray))) + ")  {";
      for (i = 0; i < 10; i++)
       {
        if (i < 9) sComment = sComment + string(aiIncArray[i]) + ", ";
        else sComment = sComment + string(aiIncArray[i]);
       }
      sComment = sComment + "}\n";
      Comment(sComment);
      //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      nAdr += 50;
      sComment = sComment + "×èòàåì ìàññèâ òèïà FLOAT: (" + string(MemoryReadFloatArrayW(Area, sPrefix, Index, NameMemory0, nAdr, afIncArray, ArraySize(afIncArray), 0, ArraySize(afIncArray))) + ")  {";
      for (i = 0; i < 10; i++)
       {
        if (i < 9) sComment = sComment + string(afIncArray[i]) + ", ";
        else sComment = sComment + string(afIncArray[i]);
       }
      sComment = sComment + "}\n";
      Comment(sComment);
      //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      nAdr += 50;
      sComment = sComment + "×èòàåì ìàññèâ òèïà DOUBLE: (" + string(MemoryReadDoubleArrayW(Area, sPrefix, Index, NameMemory0, nAdr, adIncArray, ArraySize(adIncArray), 0, ArraySize(adIncArray))) + ")  {";
      for (i = 0; i < 10; i++)
       {
        if (i < 9) sComment = sComment + string(adIncArray[i]) + ", ";
        else sComment = sComment + string(adIncArray[i]);
       }
      sComment = sComment + "}\n\n";
      Comment(sComment);
      //==== Îòìåíà ïðåäñòàâëåíèÿ ïðîåöèðóåìîãî ôàéëà è çàêðûòèå äåñêðèïòîðîâ. ===========================================================================================================================================================
      sComment = sComment + "Îòìåíÿåì ïðåäñòàâëåíèå ïðîåöèðóåìîãî ôàéëà: (" + string(MemoryUnProjectionW(Area, sPrefix, Index, "", stAddress)) + ")\n"; // Îòìåíèòü ïðîåêöèþ ìîæíî 3-ÿ ñïîñîáàìè.
//    sComment = sComment + "Îòìåíÿåì ïðåäñòàâëåíèå ïðîåöèðóåìîãî ôàéëà: (" + string(MemoryUnProjectionW(Area, sPrefix, Index, NameMemory0, NULL)) + ")\n";
      Comment(sComment);
      Sleep(2000);
      sComment = "";
     }
    //==== Îòìåíà ïðåäñòàâëåíèÿ ïðîåöèðóåìîãî ôàéëà è çàêðûòèå äåñêðèïòîðîâ. =============================================================================================================================================================
//    sComment = sComment + "Îòìåíÿåì ïðåäñòàâëåíèå ïðîåöèðóåìîãî ôàéëà: (" + string(MemoryUnProjectionW(Area, sPrefix, Index, "", stAddress)) + ")\n"; // 
//    Comment(sComment);
    //==== Çàêðûòèå äåñêðèïòîðîâ è êîíòðîëü çàêðûòèÿ. ====================================================================================================================================================================================
    sComment = sComment + "Çàêðûòî ïî èìåíè \"" + NameMemory0 + "\" ôàéëîâîãî îòîáðàæåíèÿ: (" + string(MemoryCloseNameW(Area, sPrefix, NameMemory0)) + ")\n";
    Comment(sComment);
    sComment = sComment + "Êîíòðîëü çàòêðûòèÿ. Àäðåñ: " + string(MemoryOpenProjectionW(Area, sPrefix, Index, NameMemory0)) + "\n\n";
    Comment(sComment);
   }
  //xxxx Êîíòðîëü îñíîâíûõ ôóíêöèé. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  // Òåñò ðàáî÷èé! Ðàáîòàòü áóäåò òîëüêî ó çàðåãèñòðèðîâàííûõ ïîëüçîâàòåëåé èç-çà îáúÿâëåíèÿ íåñêîëüêèõ èì¸í. Èñïîëüçóéòå, êàê îáðàçåö äëÿ íàïèñàíèÿ êîäà.
  if (CheckGeneral)
   {//==== Çàêðûòèå âñåõ îòîáðàæåíèé. ====================================================================================================================================================================================================
    sComment = sComment + "1. Îòîáðàæåíèå \"" + NameMemory1 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory1, MemorySize)) + "\n";
    Comment(sComment);
    sComment = sComment + "2. Îòîáðàæåíèå \"" + NameMemory2 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory2, MemorySize)) + "\n";
    Comment(sComment);
    sComment = sComment + "1. Îòîáðàæåíèå \"" + NameMemory1 + "\" îòêðûòî. Äåñêðèïòîð: " + string(MemoryOpenW(Area, sPrefix, Index, NameMemory1)) + "\n";
    Comment(sComment);
    sComment = sComment + "2. Îòîáðàæåíèå \"" + NameMemory2 + "\" îòêðûòî. Äåñêðèïòîð: " + string(MemoryOpenW(Area, sPrefix, Index, NameMemory2)) + "\n";
    Comment(sComment);
    sComment = sComment + "Âñå äåñêðèïòîðû çàêðûòû: (" + string(MemoryCloseAllW(Area, sPrefix, "")) + ")\n";
    Comment(sComment);
    sComment = sComment + "1. Êîíòðîëü çàêðûòèÿ. Ïîïûòêà îòêðûòü îòîáðàæåíèå \"" + NameMemory1 + "\". Äåñêðèïòîð: " + string(MemoryOpenW(Area, sPrefix, Index, NameMemory1)) + "\n";
    Comment(sComment);
    sComment = sComment + "2. Êîíòðîëü çàêðûòèÿ. Ïîïûòêà îòêðûòü îòîáðàæåíèå \"" + NameMemory2 + "\". Äåñêðèïòîð: " + string(MemoryOpenW(Area, sPrefix, Index, NameMemory2)) + "\n\n";
    Comment(sComment);
    //==== Çàêðûòèå ïî äåñêðèïòîðó ïîëüçîâàòåëüñêîãî ôàéëà. ==============================================================================================================================================================================
    sComment = sComment + "1.Îòîáðàæåíèå \"" + NameMemory1 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory1, MemorySize)) + "\n";
    Comment(sComment);
    sComment = sComment + "2.Îòîáðàæåíèå \"" + NameMemory2 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory2, MemorySize)) + "\n";
    Comment(sComment);
    sComment = sComment + "Çàêðûòî ïî äåñêðèïòîðó ïîëüçîâàòåëüñêîãî ôàéëà: (" + string(MemoryCloseHandleFileW(Area, sPrefix, NULL)) + ")\n";
    Comment(sComment);
    sComment = sComment + "1. Êîíòðîëü çàêðûòèÿ. Ïîïûòêà îòêðûòü îòîáðàæåíèå \"" + NameMemory1 + "\". Äåñêðèïòîð: " + string(MemoryOpenW(Area, sPrefix, Index,  NameMemory1)) + "\n";
    Comment(sComment);
    sComment = sComment + "2. Êîíòðîëü çàêðûòèÿ. Ïîïûòêà îòêðûòü îòîáðàæåíèå \"" + NameMemory2 + "\". Äåñêðèïòîð: " + string(MemoryOpenW(Area, sPrefix, Index,  NameMemory2)) + "\n\n";
    Comment(sComment);
    //==== Çàêðûòèå ïî èìåíè îòîáðàæåíèÿ. ================================================================================================================================================================================================
    sComment = sComment + "1.Îòîáðàæåíèå \"" + NameMemory0 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory0, MemorySize)) + "\n";
    Comment(sComment);
    sComment = sComment + "2.Îòîáðàæåíèå \"" + NameMemory0 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory0, MemorySize)) + "\n";
    Comment(sComment);
    sComment = sComment + "Çàêðûòî ïî èìåíè ôàéëîâîãî îòîáðàæåíèÿ: (" + string(MemoryCloseNameW(Area, sPrefix, NameMemory0)) + ")\n";
    Comment(sComment);
    sComment = sComment + "Êîíòðîëü çàêðûòèÿ. Ïîïûòêà îòêðûòü îòîáðàæåíèå. Äåñêðèïòîð: " + string(MemoryOpenW(Area, sPrefix, Index, NameMemory0)) + "\n\n";
    Comment(sComment);
    //==== Çàêðûòèå ïî ïðåôèêñó. Ñòðîêè. =================================================================================================================================================================================================
    // Ñîçäà¸ì îòîáðàæåíèÿ âûäåëÿÿ ïàìÿòü. Ìîæíî íå ñîçäàâàòü è ïèñàòü ñðàçó.
    hMapping1 = MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory1, MemorySize);
    sComment = sComment + "1.Îòîáðàæåíèå \"" + NameMemory1 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(hMapping1) + "\n";
    Comment(sComment);
    hMapping2 = MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory2, MemorySize);
    sComment = sComment + "2.Îòîáðàæåíèå \"" + NameMemory2 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(hMapping2) + "\n";
    Comment(sComment);
    hMapping3 = MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory3, MemorySize);
    sComment = sComment + "3.Îòîáðàæåíèå \"" + NameMemory3 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(hMapping3) + "\n";
    Comment(sComment);
    hMapping4 = MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory4, MemorySize);
    sComment = sComment + "4.Îòîáðàæåíèå \"" + NameMemory4 + "\" ñîçäàíî. Äåñêðèïòîð: " + string(hMapping4) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Ïîëó÷àåì èíäåêñ ïî èìåíè \"" + NameMemory2 + "\". Èíäåêñ = " + string(MemoryIndexByNameW(Area, sPrefix, NameMemory2)) + "\n";
    Comment(sComment);
    sComment = sComment + "Ïîëó÷àåì ïîëüçîâàòåëüñêîå èìÿ ïî èíäåêñó 3. Ïîëüçîâàòåëüñêîå èìÿ: " + MemoryUserNameByIndexW(Area, sPrefix, 3) + "\n";
    Comment(sComment);
    sComment = sComment + "Ïîëó÷àåì ïîëíîå èìÿ ïî èíäåêñó 3. Ïîëíîå èìÿ: " + MemoryFullNameByIndexW(Area, sPrefix, 3) + "\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "1. Çàïèñûâàåì ñòðîêó 1 òèïà STRING: (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory1, StartByte, sValue1)) + ")  \"" + sValue1 + "\"\n";
    Comment(sComment);
    sComment = sComment + "2. Çàïèñûâàåì ñòðîêó 2 òèïà STRING: (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory2, StartByte, sValue2)) + ")  \"" + sValue2 + "\"\n";
    Comment(sComment);
    sComment = sComment + "3. Çàïèñûâàåì ñòðîêó 3 òèïà STRING: (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory3, StartByte, sValue3)) + ")  \"" + sValue3 + "\"\n";
    Comment(sComment);
    sComment = sComment + "4. Çàïèñûâàåì ñòðîêó 4 òèïà STRING: (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory4, StartByte, sValue4)) + ")  \"" + sValue4 + "\"\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "1. ×èòàåì ñòðîêó 1 òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory1, StartByte, nSize1)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "2. ×èòàåì ñòðîêó 2 òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory2, StartByte, nSize2)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "3. ×èòàåì ñòðîêó 3 òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory3, StartByte, nSize3)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "4. ×èòàåì ñòðîêó 4 òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory4, StartByte, nSize4)) + "\"\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàêðûâàåì ïî ïðåôèêñó èìåíè (" + NamePrefix + ") ôàéëîâîãî îòîáðàæåíèÿ: (" + string(MemoryCloseAllW(Area, sPrefix, NamePrefix)) + ")\n";
    Comment(sComment);
//    Sleep(30000);
//    sComment = sComment + "Äåñêðèïòîð çàêðûò: (" + MemoryCloseHandle(Area, sPrefix, hMapping2) + ")\n";
//    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "1. Êîíòðîëü çàêðûòèÿ. ×èòàåì ñòðîêó 1 òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory1, StartByte, nSize1)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "2. Êîíòðîëü çàêðûòèÿ. ×èòàåì ñòðîêó 2 òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory2, StartByte, nSize2)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "3. Êîíòðîëü çàêðûòèÿ. ×èòàåì ñòðîêó 3 òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory3, StartByte, nSize3)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "4. Êîíòðîëü çàêðûòèÿ. ×èòàåì ñòðîêó 4 òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory4, StartByte, nSize4)) + "\"\n";
    Comment(sComment);
//    Sleep(300000);
    sComment = sComment + "Çàêðûâàåì âñ¸: (" + string(MemoryCloseAllW(Area, sPrefix, "")) + ")\n\n";
    Comment(sComment);
    //==== Çàêðûòèå ïî ïðåôèêñó. Ìàññèâû. ================================================================================================================================================================================================
    // Ïðèìåð çàïèñè áåç ñîçäàíèÿ è âûäåëåíèÿ ïàìÿòè. Äëÿ óñêîðåíèÿ ðàáîòû ëó÷øå çàðàíåå âûäåëèòü ïàìÿòü.
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà CHAR: (" + string(MemoryWriteCharArrayW(Area, sPrefix, Index, NameMemory1, StartByte, acOutArray, ArraySize(acOutArray), 0, ArraySize(acOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(acOutArray[i]) + ", ";
      else sComment = sComment + string(acOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà SHORT: (" + string(MemoryWriteShortArrayW(Area, sPrefix, Index, NameMemory2, StartByte, ashOutArray, ArraySize(ashOutArray), 0, ArraySize(ashOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(ashOutArray[i]) + ", ";
      else sComment = sComment + string(ashOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà INT: (" + string(MemoryWriteIntArrayW(Area, sPrefix, Index, NameMemory3, StartByte, aiOutArray, ArraySize(aiOutArray), 0, ArraySize(aiOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aiOutArray[i]) + ", ";
      else sComment = sComment + string(aiOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    sComment = sComment + "Çàïèñûâàåì ìàññèâ òèïà DOUBLE: (" + string(MemoryWriteDoubleArrayW(Area, sPrefix, Index, NameMemory4, StartByte, adOutArray, ArraySize(adOutArray), 0, ArraySize(adOutArray))) + ")  {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(adOutArray[i]) + ", ";
      else sComment = sComment + string(adOutArray[i]);
     }
    sComment = sComment + "}\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "Çàêðûâàåì ïî ïðåôèêñó èìåíè (" + NamePrefix + ") ôàéëîâîãî îòîáðàæåíèÿ: (" + string(MemoryCloseAllW(Area, sPrefix, NamePrefix)) + ")\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    sComment = sComment + "×èòàåì ìàññèâ òèïà CHAR: (" + string(MemoryReadCharArrayW(Area, sPrefix, Index, NameMemory1, StartByte, acIncArray, ArraySize(acIncArray), 0, ArraySize(acIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(acIncArray[i]) + ", ";
      else sComment = sComment + string(acIncArray[i]) + "}\n";
     }
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà SHORT: (" + string(MemoryReadShortArrayW(Area, sPrefix, Index, NameMemory2, StartByte, ashIncArray, ArraySize(ashIncArray), 0, ArraySize(ashIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(ashIncArray[i]) + ", ";
      else sComment = sComment + string(ashIncArray[i]) + "}\n";
     }
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà INT: (" + string(MemoryReadIntArrayW(Area, sPrefix, Index, NameMemory3, StartByte, aiIncArray, ArraySize(aiIncArray), 0, ArraySize(aiIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(aiIncArray[i]) + ", ";
      else sComment = sComment + string(aiIncArray[i]) + "}\n";
     }
    Comment(sComment);
    sComment = sComment + "×èòàåì ìàññèâ òèïà DOUBLE: (" + string(MemoryReadDoubleArrayW(Area, sPrefix, Index, NameMemory4, StartByte, adIncArray, ArraySize(adIncArray), 0, ArraySize(adIncArray))) + ")        {";
    for (i = 0; i < 10; i++)
     {
      if (i < 9) sComment = sComment + string(adIncArray[i]) + ", ";
      else sComment = sComment + string(adIncArray[i]) + "}\n";
     }
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    // ÂÍÈÌÀÍÈÅ!!! Âåñü êîä íàïèñàííûé äëÿ ïåðåâûäåëåíèÿ ïàìÿòè òåïåðü íå àêòóàëåí. Íàäî ïåðåïèñàòü. Íî îí ïðàâèëüíûé, êàê ïðèìåð. Ïàìÿòü âûäåëÿåòñÿ ïî 4096 áàéò. Íå õî÷åòñÿ ïèñàòü òåñòû íà òàêèå äëèííûå ñòðîêè, ÷òîáû ïðîâåðèòü.
    sComment = sComment + "Çàêðûâàåì âñ¸: (" + string(MemoryCloseAllW(Area, sPrefix, "")) + ")\n\n";
    Comment(sComment);
    //==== Êîíòðîëü ïåðåâûäåëåíèÿ ïàìÿòè. ================================================================================================================================================================================================
    sComment = sComment + "Ñîçäà¸ì îòîáðàæåíèå \"" + NameMemory0 + "\". Äåñêðèïòîð: " + string(MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory0, 10)) + "\n";
    Comment(sComment);
    sComment = sComment + "Ðàçìåð âûäåëåííîé ïàìÿòè: " + string(MemorySizeW(Area, sPrefix, Index, NameMemory0)) + "\n";
    Comment(sComment);
    // Ïðè çàïèñè ïàìÿòü óâåëè÷èëàñü.
    sComment = sComment + "Çàïèñûâàåì ñòðîêó òèïà STRING: (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory0, StartByte, sValue0)) + ")  \"" + sValue0 + "\"\n";
    Comment(sComment);
    // ×èòàåì òàì ãäå íå âûäåëÿëè ïàìÿòü è íå ïèñàëè. Ïðî÷èòàí ïîñëåäíèé çíàê è êîëè÷åñòâî ïàìÿòè óâåëè÷èëîñü íà äëèíó ïðî÷èòàííîé ñòðîêè ìèíóñ ïðî÷èòàííûé çíàê.
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING:             \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory0, StartByte + 20, nSize0)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "Ðàçìåð âûäåëåííîé ïàìÿòè: " + string(MemorySizeW(Area, sPrefix, Index, NameMemory0)) + "\n"; // Òåïåðü ïàìÿòü âûäåëåíà: 21 - 1 + 21 = 41
    Comment(sComment);
    sComment = sComment + "Óâåëè÷èâàåì âûäåëåííóþ ïàìÿòü: (" + string(MemoryResizeW(Area, sPrefix, Index, NameMemory0, 50)) + ")\n";
    Comment(sComment);
    sComment = sComment + "Ðàçìåð âûäåëåííîé ïàìÿòè: " + string(MemorySizeW(Area, sPrefix, Index, NameMemory0)) + "\n";
    Comment(sComment);
    sComment = sComment + "Çàïèñûâàåì ñòðîêó òèïà STRING: (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory0, StartByte + 20, sValue0)) + ")  \"" + sValue0 + "\"\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING:             \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory0, StartByte, 50)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "Çàêðûâàåì âñå äåñêðèïòîðû: (" + string(MemoryCloseAllW(Area, sPrefix, "")) + ")\n";
    Comment(sComment);
    //==== Êîíòðîëü î÷èùåíèÿ ïàìÿòè. =====================================================================================================================================================================================================
    sComment = sComment + "Ñîçäà¸ì îòîáðàæåíèå \"" + NameMemory0 + "\". Äåñêðèïòîð: " + string(MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory0, 1000)) + "\n";
    Comment(sComment);
    sComment = sComment + "Çàïèñûâàåì ñòðîêó òèïà STRING: (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory0, StartByte, sValue0)) + ")  \"" + sValue0 + "\"\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING:             \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory0, StartByte, nSize0)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "Î÷èùàåì âûäåëåííóþ ïàìÿòü: (" + string(MemoryClearW(Area, sPrefix, Index, NameMemory0)) + ")\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING:             \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory0, StartByte, nSize0)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "Çàêðûâàåì âñå äåñêðèïòîðû: (" + string(MemoryCloseAllW(Area, sPrefix, "")) + ")\n\n";
    Comment(sComment);
    //==== Êîíòðîëü íàëè÷èÿ îáëàñòè ïàìÿòè ïî èìåíè. =====================================================================================================================================================================================
    sComment = sComment + "Ñîçäà¸ì îòîáðàæåíèå \"" + NameMemory0 + "\". Äåñêðèïòîð: " + string(MemoryCreateW(Area, sPrefix, NULL, Index, NameMemory0, 10)) + "\n";
    Comment(sComment);
    sComment = sComment + "Ïðîâåðÿåì íàëè÷èå ïî èìåíè \"" + NameMemory0 + "\": (" + string(MemoryCheckNameW(Area, sPrefix, NameMemory0)) + ")\n";
    Comment(sComment);
    sComment = sComment + "Ïðîâåðÿåì íàëè÷èå ïî èìåíè \"" + NameMemory1 + "\": (" + string(MemoryCheckNameW(Area, sPrefix, NameMemory1)) + ")\n";
    Comment(sComment);
    sComment = sComment + "Çàêðûâàåì âñå äåñêðèïòîðû: (" + string(MemoryCloseAllW(Area, sPrefix, "")) + ")\n";
    Comment(sComment);
    sComment = sComment + "Ïðîâåðÿåì íàëè÷èå ïî èìåíè \"" + NameMemory0 + "\": (" + string(MemoryCheckNameW(Area, sPrefix, NameMemory0)) + ")\n";
    Comment(sComment);
    sComment = sComment + "Ïðîâåðÿåì íàëè÷èå ïî èìåíè \"" + NameMemory1 + "\": (" + string(MemoryCheckNameW(Area, sPrefix, NameMemory1)) + ")\n\n";
    Comment(sComment);
    //==== Êîíòðîëü çàïîëíåíèÿ îáëàñòè ïàìÿòè ñèìâîëàìè. =================================================================================================================================================================================
    sComment = sComment + "Çàïèñûâàåì ñòðîêó òèïà STRING: (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory0, StartByte, sValue0)) + ")  \"" + sValue0 + "\"\n";
    Comment(sComment);
    sComment = sComment + "Çàïîëíÿåì ñòðîêó âûáðàííûì ñèìâîëîì: (" + string(MemorySetW(Area, sPrefix, Index, NameMemory0, 3, 'G', 6)) + ")\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING:             \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory0, StartByte, nSize0)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "Çàêðûâàåì âñå äåñêðèïòîðû: (" + string(MemoryCloseAllW(Area, sPrefix, "")) + ")\n\n";
    Comment(sComment);
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   }
  //xxxx Êîíòðîëü ïðîåêöèè. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  if (CheckProjection)
   {//==== Ñîçäàíèå ôàéëîâîãî îòîáðàæåíèÿ. ===============================================================================================================================================================================================
    stAddress = MemoryCreateProjectionW(Area, sPrefix, NULL, Index, NameMemory0, MemorySize); // Ñîçäà¸ì îòîáðàæåíèå.
    sComment = sComment + "Î÷èùàåì ïàìÿòü ïåðåä çàïèñüþ: " + string(MemoryClearW(Area, sPrefix, Index, NameMemory0)) + "\n"; // Äëÿ ÷èñëîâûõ çíà÷åíèé íå îáÿçàòåëüíî, íî äëÿ ñòðîê æåëàòåëüíî.
    Comment(sComment);
    sComment = sComment + "Îòîáðàæåíèå \"" + NameMemory0 + "\" ñîçäàíî. Àäðåñ: " + string(stAddress) + "\n";
    Comment(sComment);
    sComment = sComment + "Çàïèñûâàåì ñòðîêó òèïà STRING: (" + string(MemoryWriteStringW(Area, sPrefix, Index, NameMemory0, 0, sValue0)) + ")  \"" + sValue0 + "\"\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory0, 0, 50)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "Çàïîëíÿåì ñòðîêó âûáðàííûì ñèìâîëîì: (" + string(MemorySetW(Area, sPrefix, Index, NameMemory0, 'X', 5, 8)) + ")\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory0, 0, 50)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "Î÷èùàåì âûäåëåííóþ ïàìÿòü: (" + string(MemoryClearW(Area, sPrefix, Index, NameMemory0)) + ")\n";
    Comment(sComment);
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING: \"" + string(MemoryReadStringW(Area, sPrefix, Index, NameMemory0, 0, 50)) + "\"\n";
    Comment(sComment);
    sComment = sComment + "Îòìåíÿåì ïðåäñòàâëåíèå ïðîåöèðóåìîãî ôàéëà: (" + string(MemoryUnProjectionW(Area, sPrefix, Index, NameMemory0, NULL)) + ")\n"; // Ìîæíî íå îòìåíÿòü ïðîåêöèþ.
    Comment(sComment);
    sComment = sComment + "Çàêðûòî ïî èìåíè ôàéëîâîãî îòîáðàæåíèÿ: (" + string(MemoryCloseNameW(Area, sPrefix, NameMemory0)) + ")\n"; // Ïðè çàêðûòèè îòîáðàæåíèÿ îòìåíà ïðîåêöèè ïðîèñõîäèò àâòîìàòè÷åñêè.
    Comment(sComment);
    sComment = sComment + "Êîíòðîëü çàêðûòèÿ. Ïîïûòêà îòêðûòü îòîáðàæåíèå. Äåñêðèïòîð: " + string(MemoryOpenW(Area, sPrefix, Index, NameMemory0)) + "\n\n";
    Comment(sComment);
   }
  //xxxx Êîíòðîëü çàêðûòèÿ ôàéëîâîãî îòîáðàæåíèÿ â äðóãîì ïðîöåññå. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  if (CheckClose)
   {//==== Çàêðûòèå âñåõ îòîáðàæåíèé. ====================================================================================================================================================================================================
    sComment = sComment + "×èòàåì ñòðîêó òèïà STRING: \"" + MemoryReadStringW(Area, sPrefix, Index, NameMemory0, StartByte, StringLen(sValue0)) + "\"\n";
    Comment(sComment);
//    sComment = sComment + "Ïîëó÷àåì ïîëíîå èìÿ ïî èíäåêñó 0: " + MemoryFullNameByIndexW(Area, sPrefix, 0) + "\n";
//    Comment(sComment);
//    sComment = sComment + "Çàêðûâàåì âñå äåñêðèïòîðû: (" + MemoryCloseAllW(Area, sPrefix, "") + ")\n\n";
//    Comment(sComment);
//    sComment = sComment + "Çàêðûòî ïî äåñêðèïòîðó ïîëüçîâàòåëüñêîãî ôàéëà: (" + MemoryCloseHandleFileW(Area, sPrefix, NULL) + ")\n";
//    Comment(sComment);
//    sComment = sComment + "Î÷èùàåì âûäåëåííóþ ïàìÿòü: (" + MemoryClearW(Area, sPrefix, Index, NameMemory0) + ")\n";
//    Comment(sComment);
//    sComment = sComment + "Çàêðûòî ïî èìåíè ôàéëîâîãî îòîáðàæåíèÿ: (" + MemoryCloseNameW(Area, sPrefix, NameMemory0) + ")\n";
//    Comment(sComment);
//    sComment = sComment + "Ðàçìåð âûäåëåííîé ïàìÿòè: " + MemorySizeW(Area, sPrefix, Index, NameMemory0) + "\n"; // Òåïåðü ïàìÿòü âûäåëåíà: 21 - 1 + 21 = 41
//    Comment(sComment);
   }
  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 }
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ

Comments