CLR Hosting : ä»®æ³ã¡ã¢ãªç·¨ (1)
å°å³ã«éè¦ããã®ãããããªãã§ããªãï¼arton ããã®ã¨ãã㨠MSDN Forums ããï¼
Java ã¨æ¯ã¹ãã° CLR Hosting API 㯠How to è¨äºãæ¸ãã¦ä¸çºã¨ããããã«ã¯ãããªãããã (MSDN ã«æ£ç¢ºãªä»æ§ãæ¸ãã¦ãªãããã) æé¨ã§ï¼ãã¤è¦å´ã®å²ã«ãã¾ãè¡ããã©ããåãããªãã¨ããæé»æãã£ã·ãã§ããï¼ã¡ãã£ã¨ã ãæéãã¨ããã®ã§è©¦ãã¦ã¿ã¾ããï¼ä¾ã«ãã£ã¦åèæ¸ã¯ãã¤ãã®æ¬ã§ããï¼ä»åã¯æ¯è²ãå¤ã㦠MSDN Magazine ã®ææ°è¨äºã®å¼ç¨æã§ãï¼
ç°¡æ½ããç®æããããã«ãå¤æ°ã®åºæ¬äºé ãçç¥ãã¾ãããCLR ã®ãã¹ãæ©è½ã®å®å ¨ãªæ¦è¦ã«é¢ãã¦ã¯ãSteven Pratschner æ°ã®èæ¸ Customizing the Microsoft .NET Framework Common Language Runtime (Microsoft Pressã2005 å¹´ç) ãåç §ãã¦ãã ããã
ä»åã¯ï¼CLR Hosting API ã使ç¨ãã¦ï¼CLR ã使ç¨ãã Virtual Alloc/Virtual Free ãããã¯ããã³ã¼ããµã³ãã«ãä½ã£ã¦ã¿ã¾ããï¼ãã¼ããµã¤ãºãå¶éããã¨ããã¨ããã¾ã§ã¯è¡ã£ã¦ãã¾ãããï¼OutputDebugString ã§å API å¼ã³åºãã®ãã°ãåºåãã¦ãã¾ãï¼
http://www.dwahan.net/nyaruru/hatena/CLRVM.zip
試ãã¦ã¿ã¦åããã¾ãããï¼SQL Server 2005 ã®ããã« CLR ã®ä½¿ç¨ã¡ã¢ãªéãå¶éããã®ã¯ï¼æ¡å¤å¤§å¤ã§ãï¼ä¾ãã°ã¢ãã¬ã¹ 0x018f0000 ãã 0x038effff ã¾ã§ã VirtualAlloc ã§ç¢ºä¿ããã³ãããããå¾ï¼0x03000000 ãã 0x038effff ã¾ã§ããã³ãããã§ãããã©ããï¼ ã§ããã¨ãã¦ã©ããªããï¼ ã¨ãã£ãé¨åãã¡ã¾ã¡ã¾ã¨è©°ãã¦ããå¿ è¦ãããã¾ãï¼ãªã«ãã«çµæ§é¢åï¼
ã¨ããããããç¨åº¦åãã¦ããç㯠main.cpp 㧠g_ManagerMode ã« Mode_ReportEx ãè¨å®ããã¨åãã¾ãï¼
ããããããã°ã¡ãã»ã¼ã¸ã«æµãã ãã§ã¾ã¨ããªæ´å½¢ã¯ãã£ã¦ãã¾ãããï¼C# å´ã§å»¶ã ãªãã¸ã§ã¯ãã®çæãè¡ã£ã¦ããã¨æ¬¡ã®ããã«äºç´é åãå¾ã ã«ã³ãããããã¦ããã®ãè¦ãã¦ãã¾ãï¼
0x038a0000 - 0x0489ffff : 16777216 byte ( 10285056 byte committed) â ãªãã¸ã§ã¯ãç¢ºä¿ â VirtualAlloc: MEM_COMMIT from 0x0426f000, 65536 byte â 0x038a0000 - 0x0489ffff : 16777216 byte ( 10350592 byte committed) â ãªãã¸ã§ã¯ãç¢ºä¿ â VirtualAlloc: MEM_COMMIT from 0x0427f000, 65536 byte â 0x038a0000 - 0x0489ffff : 16777216 byte ( 10416128 byte committed)
å¾ã¯ã¾ãäºç´ãµã¤ãºã¾ãã¯ã³ãããæ¸ã¿ãµã¤ãºã«åºã¥ãã¦ï¼ããä¸å®ä»¥ä¸ã®ãªã½ã¼ã¹ãè¦æ±ãã VirtualAlloc ã失æããã¦ã¿ãã¨ããæãã§ãããããï¼å®è£ ã¾ã ã§ããã©ï¼