System32或SysWOW64的Windows 7环境变量

Viv*_*ain 10 c# flash environment-variables system32 windows-7-x64

在Windows 7 32位或64位中是否有分别直接访问System32SysWOW64文件夹的环境变量?

我知道使用%WINDIR%\System32哪种解决方法对我不起作用.

我必须重新编译一个EXE,它引用一些应该在System32文件夹中注册的OCX .我面临的问题是我必须在64位系统中安装它,其中OCX已在SysWOW64文件夹中注册而未在System32文件夹中注册.

我该怎么办?谢谢你的帮助!

编辑:

我发现解决方案有一个引用的dll的引用flash10h.ocx.因为这flash10h.ocx必须注册.我可以在SysWOW64文件夹中注册但不能注册System32.我的系统已经有一个flash player v11.xx. 这不行吗?

请帮忙!

小智 5

以下方法将检索 32 位系统目录的路径,并可选择将其放置在环境变量 SYSDIR32 中。

public static String Get32BitSystemDirectory (Boolean placeInEnvironmentVariable = true)
{
   String sysDir = "";
   if (Environment.Is64BitOperatingSystem) sysDir = Environment.ExpandEnvironmentVariables("%windir%\\SysWOW64");
   else sysDir = Environment.ExpandEnvironmentVariables("%windir%\\System32");
   if (placeInEnvironmentVariable) Environment.SetEnvironmentVariable("SYSDIR32", sysDir, EnvironmentVariableTarget.User);
   return sysDir;
}
Run Code Online (Sandbox Code Playgroud)