110,538
社区成员
发帖
与我相关
我的任务
分享
long QuerySKInfo(LPSTR pInputData, long pInputLen, LPSTR pOutputData, long pOutputLen);
[DllImport(@"..\skComm.dll", EntryPoint = "QuerySKInfo")]
public static extern int QuerySKInfo(string pInputData, int pInputLen, string pOutputData, int pOutputLen);
[MarshalAs(UnmanagedType.LPStr)]string
public class LibWrap
{
[ DllImport( "Kernel32.dll", CharSet=CharSet.Auto )]
public static extern int GetSystemDirectory( StringBuilder
sysDirBuffer, int size );
[ DllImport( "Kernel32.dll", CharSet=CharSet.Auto )]
public static extern IntPtr GetCommandLine();
}
public class App
{
public static void Main()
{
// Call GetSystemDirectory.
StringBuilder sysDirBuffer = new StringBuilder( 256 );
LibWrap.GetSystemDirectory( sysDirBuffer, sysDirBuffer.Capacity );
…
// Call GetCommandLine.
IntPtr cmdLineStr = LibWrap.GetCommandLine();
String commandLine = Marshal.PtrToStringAuto( cmdLineStr );
}
}
long QuerySKInfo(LPSTR pInputData, long pInputLen, LPSTR* pOutputData, long pOutputLen);
[DllImport(@"..\skComm.dll", EntryPoint = "QuerySKInfo")]
public static extern int QuerySKInfo(string pInputData, int pInputLen, ref string pOutputData, int pOutputLen);
string pDataInput = "0001";
StringBuilder pDataOutput = new StringBuilder();
int iDataOutputLen = 0;
int success = QuerySKInfo(pDataInput, 84, pDataOutput, iDataOutputLen);
if (success == -1) return null;
return new PersonalInformation(pDataOutput.ToString());