forked from cedrozor/myrtille
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNativeMethods32.cs
41 lines (32 loc) · 1.44 KB
/
NativeMethods32.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
pdf scribe virtual pdf printer
all credits to Sherman Chan (https://github.com/stchan/PdfScribe)
this code is licensed under LGPL v3 (https://www.gnu.org/licenses/lgpl-3.0.en.html)
changes from original code are surrounded by "myrtille" region tags
*/
using System;
using System.Runtime.InteropServices;
namespace Myrtille.Printer
{
internal static class NativeMethods32
{
/*
This code was adapted from Matthew Ephraim's Ghostscript.Net project -
external dll definitions moved into NativeMethods to
satisfy FxCop requirements
https://github.com/mephraim/ghostscriptsharp
*/
#region Hooks into Ghostscript DLL
[DllImport("gsdll32.dll", EntryPoint = "gsapi_new_instance")]
internal static extern int CreateAPIInstance(out IntPtr pinstance, IntPtr caller_handle);
[DllImport("gsdll32.dll", EntryPoint = "gsapi_init_with_args")]
internal static extern int InitAPI(IntPtr instance, int argc, string[] argv);
[DllImport("gsdll32.dll", EntryPoint = "gsapi_exit")]
internal static extern int ExitAPI(IntPtr instance);
[DllImport("gsdll32.dll", EntryPoint = "gsapi_delete_instance")]
internal static extern void DeleteAPIInstance(IntPtr instance);
#endregion
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern bool SetDllDirectory(string lpPathName);
}
}