-1

I have an application which runs on Win7 but not on WinXp (yes we still have some of those) The reason is the dll : wiaaut.dll

Registering that dll using regsvr32 works. But the preferred method is by code (less manual labor) So we thought to load & register the assembly on load() using the following code:

       Dim asm As Assembly = Assembly.LoadFrom(System.Environment.CurrentDirectory & "\WIA\wiaaut.dll")
        Dim regAsm As RegistrationServices = New RegistrationServices()
        Dim bResult = regAsm.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase)

yet on first line i get the error: The module was expeted to contain assembly manifest I tried solving it with other similar questions here:

SO Question 1 Not really the same problem

SO Question 2

  • Target Framework of my application is 4.0 (so no problems there)
  • Changed my target configuration to x86 (still problems) , or any other configuration for that matter

SO Question 3 No actual solution offred

SO QUestion 4 No answers presnt

... And many many more ...

So to all you brianiacs over there, here is my question:

  1. How can i avoid the exception so that the code works.
  2. Or is there any other method to register a dll on the current machine (using code)
Community
  • 1
  • 1
User999999
  • 2,500
  • 7
  • 37
  • 63
  • From [MSDN](http://msdn.microsoft.com/en-gb/library/windows/desktop/ms630827(v=vs.85).aspx), quote "Applications that use the WIA Automation Layer API require Windows Vista or later. Earlier versions of Windows are not supported." Sorry! – Grim Jul 17 '14 at 11:18
  • Strange, i got it working manually registering the dll though.... – User999999 Jul 17 '14 at 11:19
  • Yeah.. quite likely you can get away with it within Windows, but to do it from code, things like .manifest files/embeds are required these days. I'll keep looking though... been a while since I messed with XP! – Grim Jul 17 '14 at 11:21

1 Answers1

2

That is not possible, wiaaut.dll is an unmanaged COM server written in C++. Only .NET assemblies can be loaded with Assembly.Load/From() and registered like this. COM servers like this one need to be registered by their DllRegisterServer() entrypoint, normally called by Regsvr32.exe

Do leave this up to the machine owner to take care of, WIA needs to be properly registered beyond just the automation interface. Running its installer is a hard requirement. WIA version 2, first available on Vista, was back-ported to XP. Microsoft had a download available for that, I noticed it has been missing a couple of months ago. That probably has something to do with XP support being terminated. There is no future for this, XP is done and over with. Ask at superuser.com for possible stray copies of this installer beyond Microsoft's reach. If there's trouble then you can't call Microsoft about it, yet another reason to not make this your problem.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Just as i feared..... Why oh Why is our IT-Infrastructure team so far behind on schedule.... Thanks for the info though! – User999999 Jul 17 '14 at 11:35