| 
			|  | 一応、C#の文字列を返すメソッドにて
 @"a" + "\0" + @"b" + "\0\0" + @"c"
 を生成して、COMとhm.NET.dllとの両方で受け取ってみました。
 
 // ---------------- NullDelimited.dll ----------------
 using System.Runtime.InteropServices ;
 using System ;
 
 [ GuidAttribute( @"a7e093cd-353a-482b-8030-ffc95eb93f3f" ) ]
 [ InterfaceType( ComInterfaceType.InterfaceIsIUnknown ) ]
 public interface INullDelimited {
 String GetNullDelimitedString() ;
 }
 
 [ GuidAttribute( @"296f5def-a494-4c5b-9f1e-c9b6570a5542" ) ]
 [ InterfaceType( ComInterfaceType.InterfaceIsIDispatch ) ]
 public interface INullDelimitedEvent {}
 
 [ GuidAttribute( @"133082d8-d63f-4de0-a5c4-985bd97fbe09" ) ]
 [ ClassInterface( ClassInterfaceType.AutoDual ) ]
 [ ComSourceInterfaces( typeof( INullDelimitedEvent ) ) ]
 public class NullDelimited : INullDelimited {
 public String GetNullDelimitedString() {
 return @"a" + "\0" + @"b" + "\0\0" + @"c" ;
 }
 }
 
 public static class NullDelimitedStatic {
 private static NullDelimited nullDelimited = default( NullDelimited ) ;
 static NullDelimitedStatic() {
 nullDelimited = new NullDelimited() ;
 }
 public static String GetNullDelimitedString() {
 return nullDelimited.GetNullDelimitedString() ;
 }
 }
 
 // ---------------- NullDelimited.dll ----------------
 
 // ---------------- NullDelimited.mac ----------------
 debuginfo 2 ;
 $nullDelimitedDllPath = currentmacrodirectory + @"\NullDelimited.dll" ;
 #nullDelimitedCom = createobject( $nullDelimitedDllPath , @"NullDelimited" ) ;
 call Dump @"COM" , callmethod_returnstr( #nullDelimitedCom , @"GetNullDeli
 mitedString" ) ;
 releaseobject #nullDelimitedCom ;
 #hmDotNet = loaddll( hidemarudir + @"\hm.NET.dll" ) ;
 call Dump @"DotNET" , dllfuncstrw( #hmDotNet , @"CallMethod" , $nullDelimite
 dDllPath , @"NullDelimitedStatic" , @"GetNullDelimitedString" ) ;
 endmacro ;
 
 Dump :
 debuginfo $$1 + @"_Value  = " + $$2 + "\U0000000A" ;
 debuginfo $$1 + @"_Length = " + str( ucs4len( $$2 ) ) + "\U0000000A" ;
 return ;
 
 // ---------------- NullDelimited.mac ----------------
 
 すると、実行結果は以下のようになりました。
 
 COM_Value  = a
 COM_Length = 1
 DotNET_Value  = a
 DotNET_Length = 1
 
 COMとhm.NET.dllとの両方において、ヌル文字"\0"以降がものの見事にカットされて
 しまいました。
 ちなみに、Windows PowerShellで
 
 Add-Type -LiteralPath '.\NullDelimited.dll'
 $s = [NullDelimitedStatic]::GetNullDelimitedString()
 $s
 $s.Length
 
 とすると、結果は
 
 a b  c
 6
 
 というヌル文字"\0"を厳格に1文字として扱う結果となっています。このことから、
 秀丸エディタ側で
 ヌル文字"\0"以降のカットが行われているものとみられます。
 
 
 
 | 
 |