2017-10-29 10 views
0

これをここで調べて、他の場所でしばらくお待ちください。https://www.scribd.com/document/56629579/64-Bit-Insider-Volume-1-Issue-7にはいくつかのオプションがあります。私は32ビットのDLLとソースコードを持っていません。そして、私はこの作業をするためにセットアップするためのIPCメカニズムをかなり理解できませんでした。32ビットDLLと64ビットDLLの間でIPCメカニズムを設定するにはどうすればよいですか?

ここではIPCなしでそれを行う私の試みです。

最初は64ビットのC#コードでこれを試しました。私はDLLのポインタへの参照を得ることができると思ったが、私はnullを持っています。

static class NativeMethods 
    { 
    [System.Runtime.InteropServices.DllImport("kernel32.dll")] 
    public static extern IntPtr LoadLibrary(string dllToLoad); 

    [DllImport("kernel32.dll")] 
    public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName); 

    [DllImport("kernel32.dll")] 
    public static extern bool FreeLibrary(IntPtr hModule); 

} 

これも機能するとも考えました。それはしませんでした。

 [DllImport("C:\\emulator\\pcshll32.dll")] 
    public static extern UInt32 hllapi(out UInt32 Func, StringBuilder Data, out UInt32 Length, out UInt32 RetC); 

このIPCメカニズムを設定するプロセスがあるようです。それをどうやって行うことができますか?

この標準コードでエラーが発生していないようだと誤解されました。私は.NET開発者ではありません。私はこれが簡単だと思いました。

/* 
    *  Just debug loaded DLL's symbol visually 
    */ 
    static void debug() 
    { 

      IntPtr hCurrentProcess = Process.GetCurrentProcess().Handle; 

      ulong baseOfDll; 
      bool status; 

      // Initialize sym. 
      // Please read the remarks on MSDN for the hProcess 
      // parameter. 
      status = SymInitialize(hCurrentProcess, null, false); 

      if (status == false) 
      { 
       System.Diagnostics.Debug.WriteLine("Failed to initialize sym."); 
       return; 
      } 

      // Load dll. 
      baseOfDll = SymLoadModuleEx(hCurrentProcess, 
             IntPtr.Zero, 
             @"C:\\emulator\\pcshll32.dll", 
             null, 
             0, 
             0, 
             IntPtr.Zero, 
             0); 

      if (baseOfDll == 0) 
      { 
       System.Diagnostics.Debug.WriteLine("Failed to load module."); 
       SymCleanup(hCurrentProcess); 
       return; 
      } 

      // Enumerate symbols. For every symbol the 
      // callback method EnumSyms is called. 
      if (SymEnumerateSymbols64(hCurrentProcess, 
       baseOfDll, EnumSyms, IntPtr.Zero) == false) 
      { 
       System.Diagnostics.Debug.WriteLine("Failed to enum symbols."); 
      } 

      // Cleanup. 
      SymCleanup(hCurrentProcess); 

     } 
} 
+0

私はちょうど32ビットおよび64ビットのコードを混在しようとし、ここで任意のIPCのメソッドが表示されません。実際のIPCが必要な場合は、それを実行する方法はたくさんあります。プロセス間では32ビットまたは64ビットのプロセスで、多くの例があるかどうかは関係ありません。 –

+0

さらに詳しい情報をお探しですか? –

答えて

0

32ビットdllを直接使用することはできません。したがって、それを使用する1つの方法は、IPC経由でdllから必要な機能を公開する小さな32ビットプログラムを作成することです。ここで

は、同様の質問です:32 bit dll importing in 64 bit .Net application

関連する問題