# System.DllNotFoundException AND 0x80070005 GetVolumeRootFromPath

 maltmann Mar 19, 2013 at 10:12 PM Edited Mar 19, 2013 at 10:20 PM Hello! First of all: Thank you very much to create this wrapper! Most times i had to automate WIM tasks i was working with "cmd /c DISM... > output.txt" calls and reading the output to let the tools decide what to do next. This is neither comfortable nor responsive and so i was very happy to find this project. But I'm facing a few problems now using the wrapper and after many hours of turning around the same issues I hope you can help me out. The problems started using your compiled DLL. I've created a reference in a new Console Application project and tried to do some easy tasks, but just recieve the "System.DllNotFoundException". The DismApi.dll is located in "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\x86\DISM" on my system, but the wrapper can't find it. So I've downloaded the source code, "hard coded" the path to the DLL in the "NativeMethods.cs" and after this the "System.DllNotFoundException" was gone. Now the first test app to read the Index of the WIM file worked fine and rocket fast! But now I have serious problems mounting / unmounting WIM files. The mount process starts and after about one minute there are about 17.000 files in the mount folder. Then suddenly the process stops and an exeption is thrown saying something like "unable to access D:...\Temp\2983213....". After this the mount folder is totally messed up. Trusted Installer is the owner and I've to do some manuel tasks (Change owner recurse, change persmissions recurse, delete the folder, perform dism /cleanup-wim...) to cleanup the system before i can give it another try. Most times the logfile only contains chinese symbols. But one time i got readable text saying "...[0x80070005] GetVolumeRootFromPath..." a few hundred times. Manual mounting / unmounting the same WIM to the same folders with DISM in cmd works fine. Any helpfull ideas would be great! Greetz edit some Details from the log: [2740] Caller requested sparse mount [2740] Enabling sparse mount. [2740] [0x80070003] FIOGetFileId:(862): Das System kann den angegebenen Pfad nicht finden. [2740] [0x80070003] FindOtherMountsForWimCallback:(392): Das System kann den angegebenen Pfad nicht finden. [2740] [0xd000000d] FIOFileOpenById:(725) [2740] [0xd000000d] FIOOpenStreamById:(1320) [2740] [0xd000000d] UnmarshallImageHandleFromId:(611) [2740] [0xd000000d] FindOtherMountsForWimCallback:(412) [2740] [0xd000000d] FIOFileOpenById:(725) [2740] [0xd000000d] FIOOpenStreamById:(1320) [2740] [0xd000000d] UnmarshallImageHandleFromId:(611) [2740] [0xd000000d] FindOtherMountsForWimCallback:(412) [2740] Mounting new image. Wim: [D:\WimUpdate\wim\install.wim] Image Index: [1] Mount Path: [D:\WimUpdate\mount] [2740] Wimserv process started for guid 113f4b07-b7b6-4c51-a6e7-e1513b321fc1. Id is 5108 [5108] ImageUnmarshallHandle: Reconstituting wim at D:\WimUpdate\wim\install.wim. [5108] Mounted image at D:\WimUpdate\mount. [2740] ImageUnmarshallHandle: Reconstituting wim at D:\WimUpdate\wim\install.wim. [2740] [0x80070005] GetVolumeRootFromPath:(2149): Zugriff verweigert [2740] [0x80070005] SetSysVolInfoPath:(3426): Zugriff verweigert [5108] [0x80070057] FltCommStubSetInformationFile:(424): Falscher Parameter. [5108] [0xc144012e] [ ERROR ] [RestoreHardlink:(6294) -> setting hardlink failed] D:\System Volume Information\WimMount\074b3f11b6b7514ca6e7e1513b321fc1\bf2fbc344643100eb64a9b505659f164812ea595\12520437.cpx (Error = 87) [5108] [0x80070057] RestoreHardlinks:(6465): Falscher Parameter. [5108] [0x80070057] RestoreFileMetadata:(2876): Falscher Parameter. [5108] [0xc144012e] [ ERROR ] [RestoreFileMetadata:(2880) -> RestoreFileMetadata: RestoreHardlinks failed] D:\System Volume Information\WimMount\074b3f11b6b7514ca6e7e1513b321fc1\bf2fbc344643100eb64a9b505659f164812ea595\12520437.cpx (Error = 87) [5108] [0x80070057] RestoreRefNode:(2282): Falscher Parameter. [5108] [0xc144012e] [ ERROR ] D:\System Volume Information\WimMount\074b3f11b6b7514ca6e7e1513b321fc1\bf2fbc344643100eb64a9b505659f164812ea595\12520437.cpx (Error = 87) [5108] [0x80070057] RestoreDirData:(4646): Falscher Parameter. [5108] [0x80070057] WIMExtractToHandleFromMountReparseDataEx:(1816): Falscher Parameter. [5108] [0x80070057] ImageExtractToHandle:(497): Falscher Parameter. [5108] [0x80070057] ImageExtract:(427): Falscher Parameter. [5108] [0x80070057] ProcessReparseData:(682): Falscher Parameter. [5108] [0x80070057] FltCommStubSetInformationFile:(424): Falscher Parameter. [5108] [0xc144012e] [ ERROR ] [RestoreHardlink:(6294) -> setting hardlink failed] D:\System Volume Information\WimMount\074b3f11b6b7514ca6e7e1513b321fc1\bf2fbc344643100eb64a9b505659f164812ea595\12520850.cpx (Error = 87) [5108] [0x80070057] RestoreHardlinks:(6465): Falscher Parameter. [5108] [0x80070057] RestoreFileMetadata:(2876): Falscher Parameter. josemesona Coordinator Mar 22, 2013 at 3:36 AM No problem, I'm glad people are finding it useful. I needed a better way to use Dism and calling Dism.exe is just terrible. I'm suprised the wrapper wasn't able to load dismapi.dll. My native method calls have the DllImport attribute which should load assembles in the following order (according to MSDN): The directory from which the application loaded. The system directory. Use the GetSystemDirectory function to get the path of this directory. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory. The current directory. The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path. Dismapi.dll should be in your %WINDIR%\System32 directory so the wrapper should be able to locate it. Can you check to see if its there? Another alternative to hard-coding it is to just copy Dismapi.dll from the ADK to the local directory you are executing your program from. What OS are you using? I only tested the wrapper on Windows 7 and Windows 8 64-bit. As for your mounting problem, that is really interesting. Is this install.wim the default file from Windows installation media or is it a custom WIM of yours? Have you tried mounting it with Dism.exe or does only the wrapper fail to mount it? If Dism.exe mounts it just fine but the wrapper does not, take your copy of the source code and modify NativeMethods.MountImage() and remove the hard-coded addition of the DismApi.DISM_MOUNT_OPTIMIZE to the flags. Optimization could be messing it up but its only a theory. I might have you send your install.wim to me and see if it fails on my machine. Also, when a WIM fails to mount and is in a wierd state, you should be able to run "Dism.exe /Unmount-Wim /MountDir:D:\WimUpdate\mount /Discard" or "Dism.exe /Cleanup-Mountpoints" to get things back in a normal state. Hopefully we can figure out what's going on. If your just mounting an image, my Windows Imaging API wrapper might be better because it gives you more control over WIM files than Dism exposes. Dyckiy Feb 23, 2016 at 7:31 PM I have almost the same problem - System.DllNotFoundException, HRESULT: 0x8007007E. dismapi.dll nowhere to be found. Dyckiy Feb 27, 2016 at 10:13 AM Edited Feb 27, 2016 at 10:16 AM The problem is solved by copying dism folder contents to a folder with the project. What's new in the dism from windows 10 and whether the new wrapper?