【问题标题】:Nsis why system pass "0" and not integerNsis为什么系统传递“0”而不是整数
【发布时间】:2019-01-28 18:32:12
【问题描述】:

我正在尝试将 func1 指针 *ir1 返回的 32 位整数传递给 func2。 但是在func2中似乎只传递了指针或null?。

System::Call 'mydll.dll::func1(*ir1, i 0x00000000)v'  
System::Call 'mydll.dll::func2(ir1)'

【问题讨论】:

  • 请贴出func1和func2的C/C++定义。

标签: nsis


【解决方案1】:

System::Call函数参数由3个部分组成;类型,输入和输出,而您没有使用输出。 *i 是指针类型,但它仍然有单独的输入和输出。

如果您的 C 代码如下所示:

void __stdcall func1(int*output, int something) { *output = 1337; }
void __stdcall func2(int input) {}

那么 NSIS 代码应该如下所示:

System::Call 'mydll.dll::func1(*i.r1, i 0x00000000)' ; '.' means no input, the value of the integer the parameter points to is undefined (but probably 0) 
System::Call 'mydll.dll::func2(ir1)'

或者如果您还需要向 func1 提供输入:

System::Call 'mydll.dll::func1(*i 666 r1, i 0x00000000)'
System::Call 'mydll.dll::func2(ir1)'

如果你的 C 函数是 __cdecl 而不是 __stdcall 那么你必须告诉系统插件:

System::Call 'mydll.dll::func1(*i.r1, i 0x00000000)?c'
System::Call 'mydll.dll::func2(ir1)?c'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-02
    • 2018-04-26
    • 2020-11-24
    • 2014-12-12
    • 1970-01-01
    相关资源
    最近更新 更多