私がc++プログラム(B3DTest.exeなど)を作成するときは、サードパーティのdll(B3DViews.dllなど)に依存します(ベンダーは小さな会社です)。私が書いたプログラムは、dll内の1つの関数をテストするだけで非常に簡単です。プログラムを起動すると(必要なヘッダーファイル、.libファイルと.dllファイルがリンクされています)。私は以下の問題に遭遇します。
The application failed to initialize properly (0xc0150002). Click on OK to terminate
the application.
メイン関数に入る前にプログラムが終了することがわかりました。vs2008IDEの出力は
LDR: LdrpWalkImportDescriptor() failed to probe e:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll
for its manifest, ntstatus 0xc0150002
プログラムとdllを別のターゲットコンピューターに配置すると、正常に動作します。ですから、私のコンピューターに何か問題があるに違いないと思います。イベントログを検索したところ、以下に3つのイベントが表示されています
EventID: 32
Description: Dependent Assembly Microsoft.VC80.CRT could not be found and Last Error was The referenced
assembly is not installed on your system.
EventID: 59
Description: Resolve Partial Assembly failed for Microsoft.VC80.CRT. Reference error message: The
referenced assembly is not installed on your system.
EventID: 59
Description: Generate Activation Context failed for Generate Activation Context
E:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll. Reference error message: The operation completed
successfully.
インターネットを検索して、誰かがインストールすることで同様の問題を修正していることを確認し
、2つのファイルをダウンロードしてインストールしましたMicrosoft Visual C++ 2005 Redistributable Package
。Microsoft Visual C++ 2005 SP1 Redistributable Package (x86).
しかし、それはうまくいきませんでした!インターネット上の別の解決策は、3つのdllとMicrosoft.VC80.MFCフォルダー(4つのdllも含む)を含むMicrosoft.VC80.CRTフォルダーのファイルを配置し、最後に対応するマニフェストファイルをB3DTest.exe(私のプログラム)のディレクトリに配置することです。 。しかし、それでも機能しませんでした!しかし、以下のようevent log
に1つしかない場所で何かが変わりました。event error
EventID: 59
Description: Generate Activation Context failed for Generate Activation Context
E:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll. Reference error message: The operation completed
successfully.
誰かが私のコンピューターのVC80.CRTとVC80.MFCのバージョンがB3DViews.dll
(ベンダーによって配布されている)のバージョン番号と一致しなかった可能性があると私に言いました。次にB3DViews.dll
、emacs.exeを使用してを開き、dllに添付されているマニフェストを検索します。それは以下に言います:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.6195"
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50727.6195"
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0"
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.MFC" version="8.0.50608.0"
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
バージョン番号は私を混乱させました。どうすれば8.0.50727.6195
よい8.0.50608.0
のでしょうか。バージョン番号は1つである必要があります(上記のように2つではありません)。Microsoft.VC80.CRTdllとMicrosoft.VC80.MFCdll、および対応するマニフェストファイルを見つけました(すべてのバージョン番号は8.0.50727.6195
C:\ Windows \ WinSxSにあり、B3DTest.exe
(私のプログラム)と同じディレクトリに配置します) 。それも機能しませんでした。問題を理解するために。私はDependency Walker for Win32 (x86)
自分のプログラムのプロファイルを作成するためにを使用しましたB3DTest.exe
。
Started "B3DTEST.EXE" (process 0x680) at address 0x00400000. Successfully hooked module.
Loaded "NTDLL.DLL" at address 0x7C920000. Successfully hooked module.
Loaded "KERNEL32.DLL" at address 0x7C800000. Successfully hooked module.
DllMain(0x7C920000, DLL_PROCESS_ATTACH, 0x00000000) in "NTDLL.DLL" called.
DllMain(0x7C920000, DLL_PROCESS_ATTACH, 0x00000000) in "NTDLL.DLL" returned 1 (0x1).
DllMain(0x7C800000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL" called.
DllMain(0x7C800000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL" returned 1 (0x1).
Injected "DEPENDS.DLL" at address 0x08370000.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" called.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" returned 1 (0x1).
Loaded "B3DVIEWS.DLL" at address 0x10000000. Successfully hooked module.
LDR: LdrpWalkImportDescriptor() failed to probe e:\tlh1987\vs2008projects\b3dtest\debug\B3DViews.dll
for its manifest, ntstatus 0xc0150002
First chance exception 0xC0150002 (Unknown) occurred in "NTDLL.DLL" at address 0x7C9873BE.
**Second chance exception 0xC0150002 (Unknown) occurred in "NTDLL.DLL" at address 0x7C9873BE.**
Exited "B3DTEST.EXE" (process 0x680) with code -1072365566 (0xC0150002).
それは私を夢中にさせます。私はそれを理解したくありません。どんな助けでもありがたいです!
これ(http://www.codeguru.com/forum/showthread.php?t=408061)が問題の解決に役立つ場合があります。しかし、私はそれを読んでそれを理解することはできません。私のシステムはwindowsxpsp3で、VS2008を使用しています。VS2005をインストールしませんでした。