Click here to Skip to main content
15,887,268 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
i'm working with the documented functions of dismapi.dll, but there is no option to control the output language of error messages. So when i execute DismGetLastErrorMessage(), i get a german text. Can i change this behaviour, so that the api displays an english text??

I think, when i change my system language the output language will change too, but i want to serve my software, so i need a dynamic language.

Thank you!
Posted
Comments
Sergey Alexandrovich Kryukov 10-Sep-15 12:35pm    
What, not platform, not language? Anyway, here is the suggestion: did you try to change the Culture and UICulture of the calling thread? I don't know if it works, just the idea... But it's very usual when some systems have just fixed language set up at installation time, or it can be option not available to client code...
—SA
Tolleule@web.de 10-Sep-15 21:35pm    
Thanks for answer, but i can't follow you: What do you mean with "did you try to change the Culture and UICulture of the calling thread?"

The platform i work with is Windows 10, but i already worked a lot with DISM API on Windows 7 with AutoIT a few years ago. Now with Windows 10 and python. I already set up the models and i can access all documented functions without any trouble.

The question i alredy had while working with AutoIT language is how i can change the output language.

Here an example:

hDism = OleDLL("C:\\Windows\\SysWOW64\\DismApi.dll") // open api

hDism.DismInitialize(1, None, None) // init DISM

When i want to get an error message i can call:

session = hDism.DismOpenSession("C:\\folder_to_mount", None, None, byref(session))

and

hDism.DismGetLastErrorMessage(byref(ErrorMessage))
print("The last error message was: %s\n" % ErrorMessage[0].Value)

A german string is printed. Now I'm looking for a solution to change the language of the output string and there is no option to do this in the API Reference of microsoft.com.

As a test i changed my system language to en-US and i got an english output but it's not a solution i can work with.

Is there a possibility, to handle this.
Sergey Alexandrovich Kryukov 10-Sep-15 21:56pm    
This was not an answer, because I don't know the answer, it was just one guess, applicable to .NET platform. This is weird that you are using a DLL of WOW64, which is a 64-bit OS platform for 32-bit applications supporting 32-bit processes. Why not 64-bit processes? And does it have to be just OLE, quite outdated technology? I'm just unaware of this thing.

The documentation on DISM is written in C/C++...
By this documentation, DismAPI library is installed at
C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment and Imaging Tools\SDKs\DismApi\Lib\
C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment and Imaging Tools\SDKs\DismApi\Include

(Yes, where 32-bit software for 64-bit OS is usually installed.)

Why not using it exactly this way?
https://msdn.microsoft.com/en-us/library/hh825838.aspx

This is some sample:
https://msdn.microsoft.com/en-us/library/hh824795.aspx

No OLE, nothing like that...

—SA
Tolleule@web.de 11-Sep-15 18:56pm    
oh, i understand now, except the part with the 32 and 64 bit processes.

The problem is, i have no experience with c++ or .net and i dont't want to. But i like to have a look into this lib file and study it. Would you be so pleasant to explain, how i can get the code of this lib or how it is used? I have installed Visual Studio Express 2012 right now, but i can't open the file with it and there is no section "Linker". I checked the internet but the IDE is soo gay, can't find a proper explanation, perhaps it's because i have the german version -.-

Do you know TeamViewer? Would you login into my pc and prepare the IDE, it's really easy with TeamViewer. That would be really nice.
Thanks
Sergey Alexandrovich Kryukov 11-Sep-15 19:16pm    
I'm afraid to say, hardly. It takes serious experience in programming. With "I don't want to" attitude there is nothing to do there, frankly...
—SA

1 solution

Please see my comments to the question.

Tolleule@web.de wrote:

no no you missunderstood me. I'm interested in programming a lot, but not in f***ing C++, this language is confusing me. I only working with python. Now, i only need a way to read the lib. When i add it to my Win32 Project i get an error "...there is no editor available for dismapi.lib". Can you help me with it?

Edit: Is a lib file a compiled file like a DLL?
I'm sorry to say: hardly, and I, unfortunately, understood you pretty much well.

You still need to know C++ very well. Then, let's say, you can do it in C#. I don't know if we have .NET wrapper for DISM. If not, you have to do it yourself, and for this purpose you have to understand a good deal of C++. If it is available, you still need serious knowledge of .NET and C#. Finally, let's say you want to use Python instead of C#. There is such thing, called Iron Python. It means knowing .NET very well. And so on…
See also:
https://en.wikipedia.org/wiki/IronPython[^],
http://ironpython.net/[^].

Let's say, however, that you want to use Python targeting native platform. But DISM API and documentation is written for C++ use, so you need some inter-operation, which will also require good understanding of C++. Please see, for example: http://www.boost.org/doc/libs/1_42_0/libs/python/doc/tutorial/doc/html/index.html[^].

Now, you really need some help with lib and DLL. Lib is nothing like DLL. This is a module of object code, pretty much a collection of object files in one file (and this is how it is implemented in *NIX, but not exactly the same way in Windows). And obj files are object files of the native code which is still to be statically linked using a linker into executable code. Please see:
https://en.wikipedia.org/wiki/Linker_%28computing%29[^],
https://en.wikipedia.org/wiki/Object_file[^]
https://en.wikipedia.org/wiki/Static_library[^].

Lib library is a static library, and DLL is a dynamic link library. Static libraries go on the input of the linker, to produce executable file. Those executable files are PE files, Portable Executable. Now, the main point is: EXE, DLL, and some other files are PE files. Actually, difference between EXE and DLL is quite subtle, but DLL is presumable used only as a library. Strictly speaking, this is not always so, and even EXE can be used not as application, and it can be used even as a library. Please see:
https://en.wikipedia.org/wiki/Portable_Executable[^],
https://en.wikipedia.org/wiki/Dynamic-link_library[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900