WIX如何知道它是否安装32位或64位软件?(How does WIX know if it's installing 32 or 64 Bit software?)
我有一个WIX安装程序,它可以创建一些注册表项并安装一些软件。 我不使用package -elements属性“Platform”,也不使用
candle.exe
开关。我想出了为什么它将软件复制到
C:\Program Files (x86)\Vendor\Product
而不是C:\Program Files\Vendor\Product
:显然,使用ProgramFilesFolder
自动重定向到32位软件路径:<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder"> <!-- 64 Bit Folder would be "ProgramFiles64Folder" --> <Directory Id="Vendor" Name="Vendor"> <Directory Id="INSTALLDIR" Name="Product">
但是我找不到类似的注册表项。 为什么WIX将注册表项从
Software\Vendor\Product
重定向到Software\WOW6432Node\Vendor\Product
? 为什么WIX认为我不安装32位软件?示例:此代码在
Software\WOW6432Node\Apache Software Foundation\Procrun 2.0\...
创建注册表项<RegistryKey Root="HKLM" Key="Software\Apache Software Foundation\Procrun 2.0\$(var.serviceName)\Parameters" ForceDeleteOnUninstall="yes"> <RegistryValue Key="Java" Name="Classpath" Type="string" Value="[JettyHomeDirectory]start.jar"/>
I have a WIX installer that creates some registry keys and installs some software. I do not use the package-elements attribute "Platform" and I also do not use the
-arch
switch ofcandle.exe
.I figured out why it copies the software to
C:\Program Files (x86)\Vendor\Product
instead ofC:\Program Files\Vendor\Product
: Apparently, the use ofProgramFilesFolder
automatically redirects to the 32-bit software path:<Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder"> <!-- 64 Bit Folder would be "ProgramFiles64Folder" --> <Directory Id="Vendor" Name="Vendor"> <Directory Id="INSTALLDIR" Name="Product">
But I cannot find something similar for registry keys. Why does WIX redirect registry keys from
Software\Vendor\Product
toSoftware\WOW6432Node\Vendor\Product
? Why does WIX think I install 32 bit software when I don't?Example: This code creates registry keys in
Software\WOW6432Node\Apache Software Foundation\Procrun 2.0\...
<RegistryKey Root="HKLM" Key="Software\Apache Software Foundation\Procrun 2.0\$(var.serviceName)\Parameters" ForceDeleteOnUninstall="yes"> <RegistryValue Key="Java" Name="Classpath" Type="string" Value="[JettyHomeDirectory]start.jar"/>
原文:https://stackoverflow.com/questions/49793229
最满意答案
您应该返回值,而不是在函数中调用
printf
:return sum;
要么
return average;
无论如何,你的函数都期望
float
返回值。 您的编译器应该已经警告过您。 无论如何,你应该能够像这样调用它(假设你在main
声明了相关的变量):sum = array_sum(myNumbers,size); average = array_average(myNumbers,size); printf("sum = %5.2f", sum); printf("avg = %5.2f", average);
显然,
array_average
函数正在执行与array_sum
相同的工作而不添加任何其他值,因此您应该通过调用array_sum
而不是复制代码来计算总和。Instead of calling
printf
in your functions, you should return the value:return sum;
or
return average;
Both your functions expect a
float
return value anyway. Your compiler should have warned you about this. Anyway, you should be able to call it like this (assuming you have the relevant variables declared inmain
):sum = array_sum(myNumbers,size); average = array_average(myNumbers,size); printf("sum = %5.2f", sum); printf("avg = %5.2f", average);
Obviously, the
array_average
function is doing a lot of the same work asarray_sum
without adding any additional value, so you should calculate the sum by callingarray_sum
instead of duplicating the code.
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
将指向一个C函数的指针作为参数传递给另一个函数(Passing a pointer to one C function as a parameter to another function)[2024-01-14]
我在FFI :: Library文档中看到了一个提示。 它说attach_function返回一个FFI::VariadicInvoker对象。 我做了一个有根据的猜测,你可以通过它代替一个proc,它有效。 module Bar extend ::FFI::Library ffi_lib './bar.so' callback :bar_func, [], :int Bar1Invoker = attach_function :bar1, [], :int attach_functio ... -
C ++将数组传递给函数,然后将其传递给另一个函数(C++ Passing Array to Function and Then Passing It to Another Function)[2022-05-22]
尝试一下,交换你的功能: #includeusing namespace std; void func2(char arr[2]) { cout << arr[0] << arr[1]; } void func(char arr[2]) { func2(arr); } int main() { char arr[2] = {1,2}; func(arr); } 问题是你正在引用func2 , func不知道任何关于func2信息。 此外,尝 ... -
您应该返回值,而不是在函数中调用printf : return sum; 要么 return average; 无论如何,你的函数都期望float返回值。 您的编译器应该已经警告过您。 无论如何,你应该能够像这样调用它(假设你在main声明了相关的变量): sum = array_sum(myNumbers,size); average = array_average(myNumbers,size); printf("sum = %5.2f", sum); printf("avg = %5.2f", a ...
-
你正在错误地实现functionone我想这样做:public void functionone(int x,int y){x = 1; y = 2; 通常不是传递参数并在方法中更改其值的方法,或者以另一种方式说,x和y应该保存您作为参数传递的值,并且不在方法内部分配。 定义全局x和全局y,然后您可以在该范围内的任何位置访问它。 例: class Abc{ int globalX; int globalY; .... public void functionone(int x, int y) ...
-
像这样的东西可以工作: def no_arg(): return 5 def one_arg(x): return x def multiple_args(x, y): return x * y def function_results_sum(*args, **kwargs): result = 0 for func in args: result += func(*kwargs[func.__name__]) return r ...
-
将匿名函数作为唯一参数传递给另一个函数(C ++)(Passing anonymous function as only parameter to another function (C++))[2022-06-18]
有多种方法可以做到这一点,但并非所有方法都适用于所有平台(例如,因为它们需要C ++ 11功能(lambdas)。 更经典的方法是这样的(没有匿名函数): #includetypedef void(*Action)(); void UniqueWrapper(Action action) { std::cout << "Generic Code 1" << std::endl; action(); std::cout << "Generic Code 2" ... -
您只需使用模板即可 template
double squarer(double x, F& func) { double y = func(x); return y * y; } You can simply do it with templates template double squarer(double x, F& func) { double y = func(x); return y * y; } -
根据C标准(6.3.2.1 Lvalues,数组和函数指示符) 4函数指示符是具有函数类型的表达式。 除非它是sizeof operator65)或一元&运算符的操作数,否则具有类型''函数返回类型''的函数指示符将转换为具有类型''指向函数返回类型的指针''的表达式 另一方面(6.5.3.2地址和间接运营商) 4一元*运算符表示间接。 如果操作数指向函数,则结果是函数指示符 ; 因此,您可以在函数指示符之前放置尽可能多的星号,因为编译器将根据自己的限制允许。:) 您可以使用operator &函数指示符。 ...