Parameters:
### Name - pointer to the buffer that receives registration name. If the UNICODE Registration Scheme is used in REGISTRATION FEATURES - Common panel then Name buffer contains unicode string otherwise ansi string (without null terminator)
### NameLen - receives a size in bytes of the Name buffer. Returns the required or passed to Name buffer number of bytes
### Key - pointer to the buffer that receives registration key. If the UNICODE Registration Scheme is used in REGISTRATION FEATURES - Common panel then Key buffer contains unicode string otherwise ansi string (without null terminator)
### KeyLen - receives a size in bytes of the Key buffer. Returns the required or passed to Key buffer number of bytes
这里Name和Key大概是个指针,还有一段C#的范例如下:
public class Enigma_IDE{ [DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)] public static extern int EP_RegLoadKeyEx(IntPtr Name, ref int NameLen, IntPtr Key, ref int KeyLen);}public static bool EP_RegistrationLoadKeyA(out string Name, out string Key)
{
Name = Key = string.Empty;
int namelen = 0, keylen = 0;
if (EP_RegLoadKeyEx(IntPtr.Zero, ref namelen, IntPtr.Zero, ref keylen) != LOADKEY_REGINFONOTFOUND)
{
byte[] namebuf = new byte[namelen];
byte[] keybuf = new byte[keylen];
if (EP_RegLoadKeyEx(Marshal.UnsafeAddrOfPinnedArrayElement(namebuf, 0), ref namelen, Marshal.UnsafeAddrOfPinnedArrayElement(keybuf, 0), ref keylen) == 0)
{
Name = Encoding.ASCII.GetString(namebuf);
Key = Encoding.ASCII.GetString(keybuf);
return true;
}
}
return false;
}