0

レジストリキーから値を読み取るための winform アプリケーションがあります。

そのためには、管理者として実行する必要があることを知っています。

Win 2003 の 2 台のサーバーがあります。1 台は 32 ビットで、もう 1 台は 64 ビットです。

32ビットでこのアプリケーションを実行すると、問題はなく、レジストリから値が読み取られます..

しかし、64 ビット サーバーからアプリケーションを実行すると、レジストリから読み取ることができません。

私は得る

system.nullreferenceexception

nullを返すregキーのルートを読み取れないためです。

マニフェストファイルも入れましたが、それでも機能しません..

どんな助けでも大歓迎です...ありがとう..

ここに私のマニフェストファイルがあります:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1">
 <asmv1:assemblyIdentity version="1.0.0.31" name="FileShareMgmt.exe" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<application />
<entryPoint>
<assemblyIdentity name="FileShareMgmt" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<commandLine file="FileShareMgmt.exe" parameters="" />
</entryPoint>
<trustInfo>
<security>
  <applicationRequestMinimum>
    <PermissionSet class="System.Security.PermissionSet" version="1"  Unrestricted="true" ID="Custom" SameSite="site" />
    <defaultAssemblyRequest permissionSetReference="Custom" />
  </applicationRequestMinimum>
  <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">       
<requestedExecutionLevel  level="highestAvailable" uiAccess="false" />
    <!-- UAC Manifest Options
        If you want to change the Windows User Account Control level replace the 
        requestedExecutionLevel node with one of the following.

    <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
    <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
    <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

        If you want to utilize File and Registry Virtualization for backward 
        compatibility then delete the requestedExecutionLevel node.
    -->     
  </requestedPrivileges>
</security>
</trustInfo>

ここに表示する必要はないと思われるマニフェストがあるため、これは完全なマニフェストではありません...

4

1 に答える 1

1

読み取ろうとしているキーが 64 ビット システムに存在することを確認しましたか?

パスは、64 ビット システムでは異なる場合があります: http://support.microsoft.com/kb/896459

レジストリ キーに「WOW6432node」というテキストが含まれている場合、それは 32 ビット バージョンです。64 ビット バージョンは、パスの一部が存在しないことを除いて、おそらく同じです。

Windows 7 64 ビット システムで OpenSubKey() が null を返すのはなぜですか?

于 2011-07-08T15:55:48.763 に答える