你从那里找的CMPPDll.dll
cmpp自己写不行嘛

解决方案 »

  1.   

    估计是长度不匹配,你用byte[] Status 代替 byte* Status 看看。
      

  2.   

    用byte[]报错:
    未处理的“System.ExecutionEngineException”类型的异常出现在 GZVOD.exe 中回复cnccbbn(totem):要求用cmppdll.dll开发,用demo测试是可以的
      

  3.   

    补充代码:
    调用时
             byte Status;
    byte Version_rep; 
             
    iRet = CMPP_Connect(sendSocket,   Source_Addr,                     AuthenticatorSP,   2,   Convert.ToUInt64(sTimestamp),
      Reserve,
      &Status,
      AuthenticatorISMG,   &Version_rep);
      

  4.   

    unsigned long 是.NET里面的uintbyte* 你也用上啦?用ref byte比较好一点,没必要弄成unsafe的。
      

  5.   

    下面是微软的帮助:
    注意这一句:
    long, unsigned long 4 bytes —————————————————————————————————————— C++ Language Reference   Fundamental TypesSee Also
    Data Type Ranges | Types
    Fundamental types in C++ are divided into three categories: integral, floating, and void. Integral types are capable of handling whole numbers. Floating types are capable of specifying values that may have fractional parts.The void type describes an empty set of values. No variable of type void can be specified — it is used primarily to declare functions that return no values or to declare generic pointers to untyped or arbitrarily typed data. Any expression can be explicitly converted or cast to type void. However, such expressions are restricted to the following uses: An expression statement. (See Expressions, for more information.) 
    The left operand of the comma operator. (See Comma Operator for more information.) 
    The second or third operand of the conditional operator (? :). (See Expressions with the Conditional Operator for more information.) 
    The following table explains the restrictions on type sizes. These restrictions are independent of the Microsoft implementation.Fundamental Types of the C++ LanguageCategory Type Contents 
    Integral char Type char is an integral type that usually contains members of the execution character set — in Microsoft C++, this is ASCII. 
        The C++ compiler treats variables of type char, signed char, and unsigned char as having different types. Variables of type char are promoted to int as if they are type signed char by default, unless the /J compilation option is used. In this case they are treated as type unsigned char and are promoted to int without sign extension. 
      bool Type bool is an integral type that can have one of the two values true or false. Its size is unspecified. 
      short Type short int (or simply short) is an integral type that is larger than or equal to the size of type char, and shorter than or equal to the size of type int. 
        Objects of type short can be declared as signed short or unsigned short. Signed short is a synonym for short. 
      int Type int is an integral type that is larger than or equal to the size of type short int, and shorter than or equal to the size of type long. 
        Objects of type int can be declared as signed int or unsigned int. Signed int is a synonym for int. 
      __intn Sized integer, where n is the size, in bits, of the integer variable. The value of n can be 8, 16, 32, or 64. (__intn is a Microsoft-specific keyword.) 
      long Type long (or long int) is an integral type that is larger than or equal to the size of type int. 
        Objects of type long can be declared as signed long or unsigned long. Signed long is a synonym for long. 
    Floating float Type float is the smallest floating type. 
      double Type double is a floating type that is larger than or equal to type float, but shorter than or equal to the size of type long double.1 
      long double1 Type long double is a floating type that is equal to type double. 
    Wide-character __wchar_t A variable of __wchar_t designates a wide-character or multibyte character type. By default, wchar_t is a typedef for unsigned short; see /Zc:wchar_t for more information. 
    Use the L prefix before a character or string constant to designate the wide-character-type constant.
     1   The representation of long double and double is identical. However, long double and double are separate types.Microsoft SpecificThe following table lists the amount of storage required for fundamental types in Microsoft C++. Sizes of Fundamental TypesType Size 
    bool 1 byte 
    char, unsigned char, signed char 1 byte 
    short, unsigned short 2 bytes 
    int, unsigned int 4 bytes 
    __intn 1, 2, 4, or 8 bytes depending on the value of n. __intn is Microsoft-specific. 
    long, unsigned long 4 bytes 
    float 4 bytes 
    double 8 bytes 
    long double1 8 bytes 
    long long Equivalent to __int64. 1   The representation of long double and double is identical. However, long double and double are separate types.END Microsoft SpecificSee Data Type Ranges for a summary of the range of values of each type. For more information about type conversion, see Standard Conversions.See Also
    Data Type Ranges | Types--------------------------------------------------------------------------------Send feedback on this topic to Microsoft© Microsoft Corporation. All rights reserved.