Hello, I am creating a .dll that I load in python with ctypes. The .dll calls Windows Installer API functions (like MsiEnumProducts). I am having trouble calling these functions from python. When I import the msilib (or _msi) that comes with python, the function calls work. But when I do not import them, the call does not work and I get the following error message:
WindowsError: [Error 182] The operatingsystem can not run %1 (Original message is in norwegian: WindowsError: [Error 182] Operativsystemet kan ikke kjøre %1) I am wondering why the function calls are not working when I do not import the msi module, and why they work when I do import the module. I am running Windows Vista and python 2.5.1. I am compiling the source code with cl (from the windows SDK) like this: cl /LD msi.c msi.def "C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib\Msi.lib" My python file looks like this: from ctypes import * # import msilib (everything works when I uncomment this) print cdll.LoadLibrary("C:\Users\Erik\Documents\INF5660\Msi.dll").test(2) The test function is defined like this in msi.c int test(int inn) { char product[100]; int i = 0; while (!MsiEnumProducts(i++, product)) { // Calling the api function (defined in msi.h) printf("%s", product); } return inn*2; } I have looked through the _msi.c source code for python 2.5.1, but I can not find any clues to what it does to make my functions work, and I have no idea what I am doing wrong with the creation of my wrappers. Anyone knows? Have a nice day, - Erik
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32