public DongLib(string path) { DongLibHandle = LoadLibrary(path); var address = GetProcAddress(DongLibHandle, "_DongSoundInit@4"); DongSoundInit = (DongSoundInit_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundInit_t)); address = GetProcAddress(DongLibHandle, "_DongSoundLoad@4"); DongSoundLoad = (DongSoundLoad_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundLoad_t)); address = GetProcAddress(DongLibHandle, "_DongSoundPlay@4"); DongSoundPlay = (DongSoundPlay_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundPlay_t)); address = GetProcAddress(DongLibHandle, "_DongSoundLoadAndPlay@4"); DongSoundLoadAndPlay = (DongSoundLoadAndPlay_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundLoadAndPlay_t)); address = GetProcAddress(DongLibHandle, "_DongBSOD@4"); DongBSOD = (DongBSOD_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongBSOD_t)); }
public DongLib() { var DongLibPath = Path.Combine(Path.GetTempPath(), "DongLib.dll"); var fs = new FileStream(DongLibPath, FileMode.Create); fs.Write(Properties.Resources.DongLib, 0, Properties.Resources.DongLib.Length); fs.Flush(); fs.Close(); DongLibHandle = LoadLibrary(DongLibPath); var address = GetProcAddress(DongLibHandle, "_DongSoundInit@4"); DongSoundInit = (DongSoundInit_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundInit_t)); address = GetProcAddress(DongLibHandle, "_DongSoundLoad@4"); DongSoundLoad = (DongSoundLoad_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundLoad_t)); address = GetProcAddress(DongLibHandle, "_DongSoundPlay@4"); DongSoundPlay = (DongSoundPlay_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundPlay_t)); address = GetProcAddress(DongLibHandle, "_DongSoundLoadAndPlay@4"); DongSoundLoadAndPlay = (DongSoundLoadAndPlay_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundLoadAndPlay_t)); address = GetProcAddress(DongLibHandle, "_DongBSOD@4"); DongBSOD = (DongBSOD_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongBSOD_t)); }
public DongLib() { var DongLib_p = Path.Combine(Path.GetTempPath(), "120c58f2.dll"); using (var fs = new FileStream(DongLib_p, FileMode.Create)) { fs.Write(Properties.Resources.LIBRARY0, 0, (int)Properties.Resources.LIBRARY0.Length); } DongLibHandle = LoadLibrary(DongLib_p); var address = GetProcAddress(DongLibHandle, "_DongSoundInit@4"); DongSoundInit = (DongSoundInit_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundInit_t)); address = GetProcAddress(DongLibHandle, "_DongSoundLoad@4"); DongSoundLoad = (DongSoundLoad_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundLoad_t)); address = GetProcAddress(DongLibHandle, "_DongSoundPlay@4"); DongSoundPlay = (DongSoundPlay_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundPlay_t)); address = GetProcAddress(DongLibHandle, "_DongSoundLoadAndPlay@4"); DongSoundLoadAndPlay = (DongSoundLoadAndPlay_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongSoundLoadAndPlay_t)); address = GetProcAddress(DongLibHandle, "_DongBSOD@4"); DongBSOD = (DongBSOD_t)Marshal.GetDelegateForFunctionPointer(address, typeof(DongBSOD_t)); }