C Function Prototype
extern int Sd_ApiInit(char *serverDb, char *logDb, char *mode, char *msgBuf, int bufSize);Synopsis
Initializes and connects to the RSA ACE/Server databases in multi-user mode.Description
Initializes and connects to the Server databases in multi-user mode. This function must be
called before any other function that performs database operations. To connect successfully,
the user must be an RSA ACE/Server administrator. The database commit mode is always
“automatic,” meaning that each API function call is a separate database transaction.Input Arguments: CserverDB Path and filename of the Server database file. May be passed as an
empty string if the VAR_ACE environmental variable is set
correctly (see page 21).logDB Path and filename of the Log database file. May be passed as an
empty string if the VAR_ACE environmental variable is set
correctly(see page 21).mode Any nonzero value for automatic commit mode. Manual commit
mode (value 0) is not supported in the current version and causes an
error.
Return Values
Values returned are OK (value 0) upon successful completion of function or ERROR
(value 1) if an error condition exists.Return Text
Connected User: UserName on Host: HostNameLogged Events
SDADMIN_UNAUTHORIZED or SDADMIN_STAR

解决方案 »

  1.   

    大侠们去哪儿了?帮帮我吧!
    都调试了一天了,还没头绪。
    到底是我的DLL封装的有问题,还是在C#中调用的有问题,还是函数的使用上的问题?给点经验或建议。
    谢谢了!
      

  2.   

    帮你顶,我也正在做呢!
    顺便
    我的是调用错误,我没有程序的代码?是vc编的dll
    qq:22443800
    email & msn :[email protected]
    等待高手帮忙!
      

  3.   

    现在问题基本已确定。是转换后的DLL在C#中调用的数据类型造成的问题,下面是我改后的代码,但仍有错误出现:(
    [DllImport("win32.dll",CharSet=CharSet.Auto,CallingConvention=CallingConvention.Winapi)]
    private static extern int  ApiRev(string msgBuf,int bufSize);调用:
    char signchar=(char)10000;
    string msg=new String(signchar,255);
    int error=ApiRev(msg,4096);
    MessageBox.Show(error.ToString());调用成功,但显示的是乱码。而CharSet字符集设定中的每一项我都试过了。有些可以用,也是乱码,有些就象下面说的会弹出错误。而同样的方法去调用ApiInit会出现“应用程序中发生了未处理的异常......未将对象引用设置到对象的实例。。”的错误。
    用StringBuidler也是同样的错误。CSDN上的相关的帖子我都看了,还没找到解决的办法。高手快来啊!
    大家帮忙顶啊!
      

  4.   

    [DllImport("win32.dll",CharSet=CharSet.Auto,CallingConvention=CallingConvention.Winapi)]
    将Winapi改为StdApi即可