Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to customize the path of dismapi.dll or dism.exe ? #168

Open
i2i8 opened this issue Jul 9, 2022 · 3 comments
Open

How to customize the path of dismapi.dll or dism.exe ? #168

i2i8 opened this issue Jul 9, 2022 · 3 comments

Comments

@i2i8
Copy link

i2i8 commented Jul 9, 2022

I want to use a custom path dismapi.dll, such as D:\lib\dismapi.dll, how to load when Winform is initialized?

@jeffkl
Copy link
Owner

jeffkl commented Jul 11, 2022

I'm pretty sure you can place dismapi.dll next to your app in a x86 and x64 folder. If your application is AnyCPU, a 32-bit machine will look for native assemblies in the x86 folder and a 64-bit machine will look in the x64 folder.

That said, I'm not sure if you're allowed to redistribute dismapi.dll as the official documentation indicates that installing the Windows Asset and Deployment Kit is required.

https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/using-the-dism-api?view=windows-11#requirements

@i2i8
Copy link
Author

i2i8 commented Jul 11, 2022

I'm sure it's possible to customize the path to dismapi.dll. For example, I copied the folder C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\ AMd64 \DISM and its subdirectories, and then, Dismapi.dll can be used in any directory, such as: D:\DISM, even if ADK is not installed on the system. I just don't know how to load diskapi.dll custom in ManagedDism.

@stdin82
Copy link

stdin82 commented Oct 29, 2022

if you place Microsoft.Dism.dll in the same directory with the custom DISM path, it will auto load dismapi.dll from that path
just make sure to use DismApi.Initialize not DismApi.InitializeEx

you can also do it manually
P/Invoke LoadLibrary dismapi.dll from the custom path, use DismApi.Initialize, then at last P/Invoke FreeLibrary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants