C#

[C#] 델파이 dll 호출

Jcoder 2020. 11. 19. 09:54

using System;

using System.IO;

using System.Runtime.InteropServices;

 

namespace Delphi_Dll_Test

{

   class Program

   {

      [DllImport("RecEncryptDLL_x64.dll"CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)]

      public static extern bool Decrypt_FileToFile(string keyFile, string sourceFile, string Targetfile, string msg);

// 델파이에서 선언한 name으로 호출

      [DllImport("RecEncryptDLL_x64.dll"CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)]

      public static extern bool EnCrypt_FileToFile(int algorithm, string keyFile, string sourceFile, string Targetfile, string msg);

// 델파이에서 선언한 name으로 호출

 

      static void Main(string[] args)

      {

         string msg = null;

 

         Decrypt_FileToFile(@"C:\test.key"@"C:\Users\JSH\Desktop\암호화1.wav"@"C:\Users\JSH\Desktop\복호화1.wav", msg);

 

         Console.WriteLine(msg);

 

         EnCrypt_FileToFile(0@"C:\test.key"@"C:\Users\JSH\Desktop\복호화2.wav"@"C:\Users\JSH\Desktop\암호화2.wav", msg);

         Console.WriteLine(msg);

 

         Console.WriteLine("Hello World!");

         

      }

   }

}