Results 1 to 16 of 16

Thread: [RESOLVED] How to run vb6 apps on wine(Linux)?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Resolved [RESOLVED] How to run vb6 apps on wine(Linux)?

    I want to test vb6 apps(such as jpbro's vbFcgi example) on wine. I've installed wine on Linux, but I don't know how to run my vb6 apps on wine. I wonder where there is such an example. Thanks!
    Last edited by dreammanor; Jun 28th, 2018 at 01:09 AM.

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418
    Last edited by Zvoni; Jun 28th, 2018 at 01:25 AM.
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3
    Addicted Member
    Join Date
    Jul 2016
    Posts
    230

    Re: How to run vb6 apps on wine(Linux)?

    Use a wine prefix to keep your various "virtual C: drives" clean:
    https://wiki.winehq.org/FAQ#Wineprefixes

    You will likely need to get winetricks to install dependencies:
    Code:
    wget "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks"
    chmod +x winetricks
    If you don't know the names of the dependencies you need, run
    Code:
    WINEPREFIX="$HOME/wine-vb6" ./winetricks
    If you do know the names of the dependencies you need, install them using:
    Code:
    WINEPREFIX="$HOME/wine-vb6" ./winetricks vb6run comctl32ocx comdlg32ocx richtx32 mdac28
    Don't follow advice from 2003 when using wine/winetricks from 2018.
    Last edited by OldClock; Jun 28th, 2018 at 01:42 AM.

  4. #4
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: How to run vb6 apps on wine(Linux)?

    OK, so now you are on the Linux side of the universe! It's a wild a wacky place, and very different to the Windows side of the universe that you are used to. So "buckle up" and get ready for some fun!

    Wine needs a "display" to work, even on headless systems with no physical monitor. There's software called Xvfb (X virtual frame buffer) that will do the trick, so I recommend installing it (on Ubuntu you can call "sudo apt-get install xvfb" to install it).

    Then you need to run Xvfb with a command like this:

    Code:
    xvfb :99 &
    The :99 is a display # (it can be any # really, I just start at 99 and count down for multiple customers...). The & symbol makes the command run in the background (without it the shell will freeze).

    Once Xvfb is running, you can run your VB6 apps. I use the "win32" architecture and always add a native DLL override for oleaut32.dll. What does "dll override" mean? Wine has it's own implementations of many Windows libraries, but some native Windows libraries work better than Wine's version. You can override the Wine versions with Windows versions (where available) by using WINEDLLOVERRIDES as follows:

    Code:
    DISPLAY=:99 WINEARCH="win32" WINEDLLOVERRIDES="oleaut32=n" wine "C:\Program Files\MyProgramFolder\MyProgram.exe"
    The above basically says "launch MyProgram.exe in a 32-bit Windows session using display 99 and the native version of oleaut32.dll"

    That should be it

    Of course, you'll probably want to daemonize your app (make it a "service" in Windows speak) but that's a whole different issue, and there are a few different daemon systems for Linux (upstart and systemd are the 2 most popular AFAIK). Each daemon system has a different set of rules to work with and code against. The nice thing is that you can daemonize your app with scripts (so no need to compile anything).

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: How to run vb6 apps on wine(Linux)?


  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: How to run vb6 apps on wine(Linux)?

    Quote Originally Posted by OldClock View Post
    Use a wine prefix to keep your various "virtual C: drives" clean:
    https://wiki.winehq.org/FAQ#Wineprefixes

    You will likely need to get winetricks to install dependencies:
    Code:
    wget "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks"
    chmod +x winetricks
    If you don't know the names of the dependencies you need, run
    Code:
    WINEPREFIX="$HOME/wine-vb6" ./winetricks
    If you do know the names of the dependencies you need, install them using:
    Code:
    WINEPREFIX="$HOME/wine-vb6" ./winetricks vb6run comctl32ocx comdlg32ocx richtx32 mdac28
    Don't follow advice from 2003 when using wine/winetricks from 2018.
    Hi OldClock, thank you for your information and detailed explanation.

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: How to run vb6 apps on wine(Linux)?

    Quote Originally Posted by jpbro View Post
    OK, so now you are on the Linux side of the universe! It's a wild a wacky place, and very different to the Windows side of the universe that you are used to. So "buckle up" and get ready for some fun!

    Wine needs a "display" to work, even on headless systems with no physical monitor. There's software called Xvfb (X virtual frame buffer) that will do the trick, so I recommend installing it (on Ubuntu you can call "sudo apt-get install xvfb" to install it).

    Then you need to run Xvfb with a command like this:

    Code:
    xvfb :99 &
    The :99 is a display # (it can be any # really, I just start at 99 and count down for multiple customers...). The & symbol makes the command run in the background (without it the shell will freeze).

    Once Xvfb is running, you can run your VB6 apps. I use the "win32" architecture and always add a native DLL override for oleaut32.dll. What does "dll override" mean? Wine has it's own implementations of many Windows libraries, but some native Windows libraries work better than Wine's version. You can override the Wine versions with Windows versions (where available) by using WINEDLLOVERRIDES as follows:

    Code:
    DISPLAY=:99 WINEARCH="win32" WINEDLLOVERRIDES="oleaut32=n" wine "C:\Program Files\MyProgramFolder\MyProgram.exe"
    The above basically says "launch MyProgram.exe in a 32-bit Windows session using display 99 and the native version of oleaut32.dll"

    That should be it

    Of course, you'll probably want to daemonize your app (make it a "service" in Windows speak) but that's a whole different issue, and there are a few different daemon systems for Linux (upstart and systemd are the 2 most popular AFAIK). Each daemon system has a different set of rules to work with and code against. The nice thing is that you can daemonize your app with scripts (so no need to compile anything).
    Hi jpbro, I'm testing your method, which may take 1 or 2 days. Extremely grateful.
    Last edited by dreammanor; Jun 29th, 2018 at 07:52 AM.

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: How to run vb6 apps on wine(Linux)?

    Hi jpbro, I fell down while running in the mountains 10 days ago, my left and right arms were broken, so I asked my friend to do some testing work for me. He now encounters some problems:

    (1) Run vbFcgiHost.exe directly on the wine, and the error prompts are as follows:

    Code:
    root@ubuntu:/VbFcgi-master/bin# wine vbFcgiHost.exe
    err:winedevice:ServiceMain driver L"WineBus" failed to load
    err:winediag:nulldrv_CreateWindow Application tried to create a window, but no driver could be loaded.
    err:winediag:nulldrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
    wine: Unhandled stack overflow at address 0x7bc57726 (thread 0009), starting debugger...
    err:seh:setup_exception_record stack overflow 1072 bytes in thread 0009 eip 7bc4fdbb esp 00240f00 stack 0x240000-0x241000-0x340000
    (2) Run vbFcgiHost.exe according to your method, and the error prompts are as follows:
    Code:
    root@ubuntu:/VbFcgi-master/bin# DISPLAY=:99 WINEARCH="win32" WINEDLLOVERRIDES="oleaut32=n" wine "vbFcgiHost.exe"
    err:module:import_dll Library oleaut32.dll (which is needed by L"C:\\windows\\system32\\windowscodecs.dll") not found
    err:module:import_dll Library windowscodecs.dll (which is needed by L"C:\\windows\\system32\\winemenubuilder.exe") not found
    err:module:LdrInitializeThunk Main exe initialization for L"C:\\windows\\system32\\winemenubuilder.exe" failed, status c0000135
    err:winedevice:ServiceMain driver L"WineBus" failed to load
    err:module:import_dll Library oleaut32.dll (which is needed by L"C:\\windows\\system32\\actxprxy.dll") not found
    err:ole:COMPOBJ_DllList_Add couldn't load in-process dll L"C:\\windows\\system32\\actxprxy.dll"
    err:ole:CoGetClassObject no class object {b8da6310-e19b-11d0-933c-00a0c90dcaa9} could be created for context 0x80000001
    err:ole:marshal_object couldn't get IPSFactory buffer for interface {6d5140c1-7436-11ce-8034-00aa006009fa}
    err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hres=0x80004002
    err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, 80004002
    err:ole:get_local_server_stream Failed: 80004002
    fixme:event:wait_for_withdrawn_state window 0x10048/800001 wait timed out
    fixme:atl:AtlAxWinInit version 0300 semi-stub
    Could you take a look at this question for me? Much appreciate.
    Last edited by dreammanor; Jul 5th, 2018 at 10:46 PM.

  9. #9
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: How to run vb6 apps on wine(Linux)?

    Quote Originally Posted by dreammanor View Post
    Hi jpbro, I fell down while running in the mountains 10 days ago, my left and right arms were broken, so I asked my friend to do some testing work for me. He now encounters some problems:
    Oh no! Sorry to hear that ! I hope you recover quickly!

    Regarding the errors - the second attempt looks better than the first, the main problem seems to be that you don't have the Windows native oleaut32.dll installed. Can you try running this command to install the VB runtimes:

    Code:
    winetricks vb6run
    Then try starting the VbFcgiHost.exe again?

    Note that Wine can be very "noisy" with debug messages, so once everything is running OK you will probably want to silence it. You can do this using the WINEDEBUG parameter, something like this:

    Code:
    DISPLAY=:99 WINEARCH="win32" WINEDEBUG="-all" WINEDLLOVERRIDES="oleaut32=n" wine "vbFcgiHost.exe"
    But it's probably best to leave the debugging messages on until you get things working.

    Hope that helps!

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: How to run vb6 apps on wine(Linux)?

    Hi jpbro, thank you very much. My friend can now run nginx on the Wine, but there is an error when executing the code DISPLAY=:99 WINEARCH="win32" WINEDEBUG="-all" WINEDLLOVERRIDES="oleaut32=n" wine "vbFcgiHost.exe"

    Code:
    root@ubuntu:/VbFcgi-master/bin# DISPLAY=:99 WINEARCH="win32" WINEDEBUG="-all" WINEDLLOVERRIDES="oleaut32=n" wine "vbFcgiHost.exe"                               
    wine: WINEARCH set to win32 but '/root/.wine' is a 64-bit installation.
    Does he have to install 32-bit wine? Or can he run the above code correctly by changing the parameters of the 64-bit wine? Thanks very much.


    Edit:

    In addition, the error message for running vbFcgiHost.exe is as follows:

    Code:
    2018/07/11 10:43:47 [error] 47#51: *19 FastCGI sent in stderr: "" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /VbFcgiApp.fcgi HTTP/1.1", upstream: "fastcgi://127.0.0.1:9100", host: "127.0.0.1:8080"
    
    2018/07/11 10:43:47 [error] 47#51: *19 FastCGI sent in stderr: "Automation error, Line #280" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /VbFcgiApp.fcgi HTTP/1.1", upstream: "fastcgi://127.0.0.1:9100", host: "127.0.0.1:8080"
    
    2018/07/11 10:43:47 [error] 47#51: *19 upstream sent unsupported FastCGI protocol version: 0 while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /VbFcgiApp.fcgi HTTP/1.1", upstream: "fastcgi://127.0.0.1:9100", host: "127.0.0.1:8080"
    Last edited by dreammanor; Jul 11th, 2018 at 10:37 AM.

  11. #11
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: How to run vb6 apps on wine(Linux)?

    Sounds like he created a 64-bit Wine "prefix"/environment, but my command is calling for a 32-bit one. I've always just used the 32-bit Wine prefix, so I can't confirm whether it will work OK under a 64-bit one.

    You can try to run it under 64-bit as follows:

    Code:
    DISPLAY=:99 WINEDEBUG="-all" WINEDLLOVERRIDES="oleaut32=n" wine "vbFcgiHost.exe"
    (NOTE: I dropped the WINEARCH parameter above to use the default architecture which is 64-bit).

    Or, you can delete the entire /home/<username>/.wine folder and sub-folders (WARNING YOU WILL LOSE EVERYTHING IN YOUR WINE ENVIRONMENT AND WILL BE STARTING FRESH), then create a new 32-bit Wine prefix as follows:

    Code:
    DISPLAY=:99 WINEARCH="win32" WINEDEBUG="-all" WINEDLLOVERRIDES="oleaut32=n" wineconsole
    Then exit the console when it appears.

    After that you can reinstall the VbFcgi stuff and you app,etc... and everything should be 32-bit so you can use the original command.

    Hope that helps!

  12. #12
    New Member
    Join Date
    Jul 2018
    Posts
    8

    Re: How to run vb6 apps on wine(Linux)?

    Hi jpbro:
    I installed the Ubuntu14.04 32-bit, wine tried 1.6,2.4,3.0 several versions. But there are always some error tips! So I don't know if I can trouble you. Tell me about your operating environment. I will directly simulate your environment to try out the operation of vbFcgiHost.exe. Another problem is, you are running nginx in the 'VbFcgi-master' folder via wine, or is it using nginx installed in ubuntu?

  13. #13
    New Member
    Join Date
    Jul 2018
    Posts
    8

    Re: How to run vb6 apps on wine(Linux)?

    Maybe I'm a new user, I can't modify my post, so I rewrote one:

    Hi jpbro:

    I installed the Ubuntu14.04 32-bit, and tried several versions of wine, such as V1.6, V2.4 and V3.0 , but there are always some error prompts! I would like to know what version of Ubuntu and Wine you are using. Also, does Nginx need to use Winsock? What version of Winsock do you use?

    Another problem is, are you running nginx in the 'VbFcgi-master' folder via wine, or using nginx installed in ubuntu? Thanks.

  14. #14
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: How to run vb6 apps on wine(Linux)?

    Hi @yfhao - sorry I've been really busy with other stuff the past while, but I will try to get back to you tomorrow. Quickly - Ubuntu 14.04 32-bit is fine, and the latest wine is best (with a 32-bit wine prefix). IMO the Linux version of Nginx should be run with a fastcgi_pass parameter set to you VbFcgi backend. Sorry for the minimal explanation, I will try to write a step-by-step article as soon as I can, but I can't promise a timeline right now

  15. #15
    New Member
    Join Date
    Jul 2018
    Posts
    8

    Re: How to run vb6 apps on wine(Linux)?

    Thank you for your reply, look forward to your step-by-step article.

  16. #16

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: How to run vb6 apps on wine(Linux)?

    Quote Originally Posted by jpbro View Post
    IMO the Linux version of Nginx should be run with a fastcgi_pass parameter set to you VbFcgi backend.
    Hi jpbro, If I install the Linux version of Nginx, do I need to change the configuration parameters of vbFcgi or nginx? This question is not urgent, you could reply when you have a free time, thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width