最近跟一恶心公司做接口,对方公司只给一个C++代码让我去调用.. 本人对P/invoke不熟悉,寻求高手帮助!!
C++ 代码
HINSTANCE hInst = LoadLibrary("DESBase64.dll");
if(hInst)
{
typedef char* (PASCAL *MYFUNC)(char*,char*);
MYFUNC funDecrypt = NULL;
MYFUNC funEncrypt = NULL;
funDecrypt=(MYFUNC)GetProcAddress(hInst, "Decrypt");
funEncrypt=(MYFUNC)GetProcAddress(hInst, "Encrypt");
char* sss = (char*)malloc(200);
memset(sss, 0x0, 200);
if(funEncrypt)
strcpy(sss, funEncrypt("HCISRHIS","user_name=myname&password=mypassword&type=1&patient_ID=xxxxx&visist_id=xxxxx&hospital_id=xxxxx11111111"));
AfxMessageBox(sss);
if(funDecrypt)
strcpy(sss, funDecrypt("HCISRHIS",sss));
AfxMessageBox(sss);
free(sss);
FreeLibrary(hInst);
}
代码的功能是:输入相关参数,返回 加密字符串!
//////////////////
请问大家,如果用C# 实现当前功能!!