locked
Win32 App won't run in Windows 2000 RRS feed

  • Question

  • I am using Visual Studio 2010.  I need to build a dll (WINAPI) that will link to any user app that calls it.  As part of this development I designed a test exe and built it all into a VS Installer project.  Works fine in XP, but the main customer that this is being developed for is still using Windows 2000, and that's where the problems begin.  Problem 1: was the installer wouldn't run, got around this by using installshield to build installer.  Problem 2:  when I try to run the exe I got a message that the exe wasn't valid win32 app.  Problem 3:  Tried building small app in VB6 just to call one of the routines in the dll (once again, works fine in XP), message displayed is can't find dll, even though it's right there in system32 where it should be.  Any way to make the dll work in win2000?  if not, what version of VS do I need to try to find?
    Monday, March 19, 2012 8:09 PM

Answers

  • I installed express addition of VC++ 2008.  In VC 2010 projects for dll and test app, changed platform toolset to VC90 in properties, and now it runs in win2K.

    George Ekker

    • Marked as answer by George Ek Tuesday, March 20, 2012 3:49 PM
    Tuesday, March 20, 2012 3:48 PM

All replies

  • Hi,

    I think we need a lot more information to be able to help you:

    a) What exactly did you do to build a DLL? What kind of DLL did you build?

    b) How did you build the installer? What error did you get?

    c) What kind of test application did you build? Are you sure, that the binary was transmitted to the target system correctly? Maybe it got corrupted on the transfer? Without details it is quite hard to help you but from my understanding I would expect, that the exe was broken during the transport because the EXE should be in a defined format and the error message you gave is interpreted by me, that this defined format wasn't detected.

    d) What kind of DLL did you build? How do you access it? Maybe the DLL must be registered first?

    With kind regards,

    Konrad

    Tuesday, March 20, 2012 8:47 AM
    Moderator
  • a)  The dll is just a regular dll created as a win32 console project in VS 2010, exports defined in .def file.  It uses standard libraries.

    b)  The installer was created using VS 2010 and is Visual Studio Installer setup project.  The error is "GetNativeSystemInfo can't be located in Kernel32.dll"

    c)  Test app was built in VS 2010 it also uses standard libraries, dll is linked as an additional dependancy.  I copied back the exe that was installed on the win2k system and did a comparison to the original file that runs in XP; they were identical.

    d) The dll is just a regular WINAPI (stdcall) dll.  I tried accessing it using "LoadLibrary" and "GetProcAddress" and by declaring the inported functions as external; both methods work in XP; neither work in win2k.

    Everything works fine in XP.  Problem seems to be win2k.  Is win2k not supported in VS 2010?  What version would I need to get to develop for win2k if not?


    George Ekker

    Tuesday, March 20, 2012 12:48 PM
  • Hi Mramba,

    thank you for the additinal information. It is a quite interesting thing and I am still doing some research on it.

    Regarding the setup project: It seems that Microsoft decided to use some newer calls inside it (e.g. the GetNativeSystemInfo inside Kernel32.dll which is available starting with Windows XP / 2003.)

    I will look that up further - at the moment it seems that it started with Visual Studio 2010 and this problem should not happen with Visual Studio 2008. (But that still needs more research!).

    Regarding the other points I am still a little confused. The PE/COFF specification also covers W2K: http://msdn.microsoft.com/en-us/windows/hardware/gg463119

    Is it possible to send me a small test project? That would take a little work from my shoulders to create some test cases. You can send them to konrad at neitzel.de

    Thank you.

    With kind regards,

    Konrad

    Tuesday, March 20, 2012 2:05 PM
    Moderator
  • I have read more about this and found that VS 2010 can't build binaries that run on win2k.  Seems like another of those "buyer beware" scenarios that so often involve MS products.  The "workarounds" seem dubious at best and I'm skiddish about using them for something that is going to a customer.  But do I need VS2008 or do I need to try and find VS2005?

    George Ekker

    Tuesday, March 20, 2012 2:17 PM
  • I installed express addition of VC++ 2008.  In VC 2010 projects for dll and test app, changed platform toolset to VC90 in properties, and now it runs in win2K.

    George Ekker

    • Marked as answer by George Ek Tuesday, March 20, 2012 3:49 PM
    Tuesday, March 20, 2012 3:48 PM
  • Hi George,

    I was able to spend some more time to do a research, too.

    First you last question: Visual Studio 2008 should be ok. There is no need to go back to VS 2005!

    But regarding the compilation of your software, I would suggest another solution which is much better in my eyes: Native Multi-Targeting.
    The problem is, that the c++ compiler package (including compiler, linker and libraries) changed multiple things:
    - PE 5.01 binaries are now created. W2K requires PE 5.00
    - The CRT has calls to EncodePointer and DecodePointer which are not available in W2K.

    There are solutions to this (so you could tell the linker to create PE 5.00 binaries and you could create your own CRT) but that are bloody workarounds which I wouldn't do or try.

    Instead you can just install the c++ compiler package inside Visual Studio 2010 and use it inside your projects. That way you get the benefits of the new GUI.

    You can find details on:
    http://blogs.msdn.com/b/vcblog/archive/2009/12/08/c-native-multi-targeting.aspx
    http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx

    But this will not solve the issue with the installer. It could be worth a try to use WiX instead. We switched to WiX in the past because of some other issues we had with setup projects in Visual Studio.

    With kind regards,

    Konrad

    Tuesday, March 20, 2012 3:50 PM
    Moderator