Frage

Using the method described in http://forum.xda-developers.com/showthread.php?t=1944675 I executed a win32 desktop app in my surface with Windows RT.

Loading windows dlls like user32.dll, kernel32.dll, gdi32.dll and etc, using LoadLibrary is possible. But when I try to load "comctl32.dll" or "comdlg32.dll" using LoadLibrary, It returns NULL.

The error code returns by GetLastError() is 1114. It means "A dynamic link library (DLL) initialization routine failed."

EDIT: When I test my app which compiled for x86, It works without any problem. When I build it for ARM and run under Windows RT this error occurred.

Sample code:

HMODULE hModule;
hModule = LoadLibraryA("user32.dll");
printf("Load Library user32.dll : %x with Err: %x\n", hModule, GetLastError());
hModule = LoadLibraryA("kernel32.dll");
printf("Load Library kernel32.dll : %x with Err: %x\n", hModule, GetLastError());
hModule = LoadLibraryA("comctl32.dll");
printf("Load Library comctl32.dll : %x with Err: %x\n", hModule, GetLastError());
War es hilfreich?

Lösung

But loading Microsoft approved dll like user32.dll and comctl32.dll is possible

Your assumption that comctl32.dll is "approved" is wrong. None of its exported functions is on the list of winapi functions that can be used in a Store app. Its only use is to provide an implementation for the common controls, none of which are usable in a Store app. It can only be used for desktop apps, you cannot write those yourself on Windows RT.

Microsoft had no reason to make comctl32.dll work in the sandbox for a Store app. It is thus expected to fail to work.

Loading kernel32 and user32 is possible, those DLLs do contain approved winapi functions. However, using any function that is not on the approved list will get you a fail in the validation test. You cannot get such an app published.

Andere Tipps

Normally when I've used ComCtl32.dll I also add a manifest dependency as described in this MSDN article (specifically this section). Not sure if that's the reason why you can't load it, but if you want to use it in any way you probably need to add the manifest info.

Don't know about ComDlg32.dll.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top