DOSBOX running external windows program - batch-file

Is it possible to open window's file explorer from Dosbox?
When I try to open it, it shows:
"This program cannot be run in DOS mode."
I type run.bat in dosbox, and I run this file:
run.bat:
c:
cd Windows
cd System32
explorer.exe "http:\\test.com"
thank you!

DOSBOX emulates a 16bit hardware. Explorer.exe is either 32 bit or 64 bit. No chance to run that from Dosbox. You would need an 16 bit browser (if you google, look for "windows 3.1"). But don't expect them to be compatible with modern websites (Java, Flash, .HTML4/5,Silverstar,...)
You don't want to run explorer inside the dosbox, but want the dosbox to open the explorer of your guest system (your physical computer, not the emulated 16bit DosBox-Computer)? This translates to "how do I run a program on a different computer". There are tools to do so (like psexec) but I don't know any 16bit versions.

Related

How to synchronize code files on windows with WSL/linux?

Basically I have some C/C++ code that I need to build and debug on a Linux machine. Unfortunately, my windows laptop doesn't have enough free hard space to install some Linux dist nor does it have enough free RAM to comfortably run VM.
Until now, I dealt with it rather comfortably using WSL, but the scale was rather small. It was easy to edit and debug 2-3 .c files through CLI and gdb, but it became really annoying on a large scale projects.
I want something simple as "edit code in windows IDE [X], compile it on remote Linux/WSL (the project uses Makefiles), and preferably debug it via gdb".
VS has something close to what I want, but it can't deal with existing Linux projects. It needs to create a new configuration which is alien to the project's Makefile.
I know this question is a bit old, but I think the solution is to make a symlink between your WSL folder and the Window's folder. This is how I handled it for a Ubuntu-20.04 WSL:
Access PowerShell in Administrator mode
Type cmd.exe in the PowerShell
Once cmd.exe is opened, type mklink /d C:\<path_to_your_Windows_folder> \\wsl$\Ubuntu-20.04\home\<your_user>\<path_to_your_WSL_folder>
EDIT
This was tested under Windows 10 Version 2004 with WSL2
I'm unsure about C and C++ but it sounds like this is exactly the same as how i work in node and javascript every day.
I checkout my code using git inside WSL to a location like /mnt/c/code/myproject. Then using sublime/VS code/webstorm i edit the files in windows in the location c:\code\myproject this works really well and have been doing this every day for over a year.
Things to be aware of are that you need to ensure that your editor of choice saves files with linux line endings and that all command line operations are done inside WSL.
Please see this article to see the differences between windows and linux files and how this works inside the WSL.
I want something simple as "edit code in windows IDE , compile it on remote linux/WSL
You will have something as simple as that.
Only with Windows 19.03 though:
See "Updated WSL in Windows 10 version 1903 lets you access Linux files from Windows"
Microsoft's Craig Loewen says:
In the past, creating and changing Linux files from Windows resulted in losing files or corrupting data. Making this possible has been a highly requested and long anticipated feature. We're proud to announce you can now easily access all the files in your Linux distros from Windows.
So how does this work? He goes on to explain:
To put it briefly: a 9P protocol file server facilitates file related requests, with Windows acting as the client.
We've modified the WSL init daemon to include a 9P server. This server contains protocols that support Linux metadata, including permissions.
There is a Windows service and driver that acts as the client and talks to the 9P server (which is running inside of a WSL instance).
Client and server communicate over AF_UNIX sockets, since WSL allows interop between a Windows application and a Linux application using AF_UNIX as described in this post.
Warning:
The old rules still apply, you should NOT access your Linux files inside of the AppData folder!
If you try to access your Linux files through your AppData folder, you are bypassing using the 9P server, which means that you will not have access to your Linux files, and you could possibly corrupt your Linux distro.

Defining path to run for linux as well as windows

I have c program where i have to save a file in ubuntu. The program runs fine on my local pc but i want to use a single exe for other pcs whether they run linux or windows. So, how should i give path to store file that it works everywhere?
Sorry, but you can't do what you want.
When an Operating System runs a program, it looks in the file to find things that it needs to know. Windows and Linux store this information in incompatible ways, so you won't be able to create a file that will run under both Windows and Linux.

What's the difference between MS-DOS and Batch?

I read that apparently MS-DOS and Batch are NOT the same thing, but that's how I've been taught.
I couldn't find sites or a Q&A on it so can anyone help shed some light?
Batch file language is part of MSDos. It has also been part of MSDos successors - OS/2, Windows 16 bit, Win 32 on 9x as a MSDos 7, and on Win NT 32 bit as MSdos 5.5 which is the current one. 64 bit doesn't have MSDos.
In OS/2 IBM engineers tried bolting programming language constructs on to MSDos batch - Microsoft engineers updated this for Windows 2000. To remain compatible with MSDos batch this requires horrible hacks. The two command processors are
command.com - 16 bit MSDos command processor. There are many versions 1,2, 3, 3.3, 4, 5, 6, 6.22, (on 9x) 7, 7.1, (on Win NT) 5.5.
cmd.exe - 32 bit or 64 bit windows command processor that understands MSDos syntax as well. There are two main versions - NT4 and OS/2 and Windows 2000 and later.
In Windows if you type in command.com it sends your command to cmd.exe to be executed.
Try this.
Type in Start - Run
cmd
then in the console window
ver
Then type in Start - Run
command
then in the console window
ver
Then type in Start - Run
command /k ver
ALSO
Just because a program is a console program does not imply that either command processor is involved. It you type ftp in Start - Run only ftp.exe is running in that console.
MS Dos is the Microsoft Disk Operating System nowadays just reffered to as an OS. Windows has now become a part of the Microsoft OS and is a graphical layer allowing much more operability to the end user but we still have access to many DOS based commands.
This is done through the Command Prompt (CMD.EXE).
The Command prompt allows a terminal style (none graphical) environment where we can put together commands to interact with the machine. For example, DIR will give a directory listing for the current directory. These commands can be manipulated with parameters being passed in for example DIR /AD /S will use AD to list all Directories (not files) and /S will recurse through subdirectories.
If you spend any time working in a DOS environment there are many commands you would want to string together, You can create a text file with a .bat extension to allow this, running this "Batch" file will run the commands sequentially one after the other. It is exactly as the name implies, a Batch of commands for it to perform.
The Batch file DOES allow for some basic loops and a GoTo style jump. A perfect example of a Batch file in it's basic form was Autoexec.bat. This was used as your computer booted to fire off commands to load drivers for audio cards / graphics cards / network cards etc.
I STILL use the Command prompt very often, I find it easier to create a batch file from a bunch of formulas in Excel for 1 off repetitive commands and I can do this quicker than I probably could if I were to build a VBA solution to interact with the files.

What is blocking driver installation in Windows?

I've written a C program in Windows that uses some precompiled files from WinDivert. My program uses a .dll from WinDivert and some of the functions in the .dll install the WinDivert.sys driver. There are also a few more files from WinDivert that are a part of this (a .lib, a .inf, and another .dll).
The problem is that on one of my computers (Windows 8.1 64 bit), everything works perfectly. But, when I try to use the program on my laptop (Windows 8.1 64), my friend's laptop (Windows 7 64), or another Windows 7 64 desktop, something blocks the installation of the driver. I'm unsure what is blocking it or how to stop it from being blocked because on all computers:
+I'm running on an admin profile
+Running the program in admin command prompt
+Tried disabling firewall, anti virus, etc (although it runs fine with these on for the computer that works)
+As far as I can tell, all my security settings are the same
+Note: the driver does have a valid signature.
Why does the driver install perfectly on one computer, but not on the other three? What could be issue?
The main causes for 1275 errors are documented on the WinDivert FAQ. However, there may be other causes that I'm unaware of (perhaps some experts out there can help?)
Another thing to try is the following commands:
sc stop WinDivert1.1
sc delete WinDivert1.1

How to generate .exe drivers instead than .sys?

I'm new in kernel mode world. I've tried to write a simple "hello world" driver in a Windows 7 virtual machine, I'm using WDK 7600.16385.1 -> x86 Free Build Environment for compilation, when it does, the generated driver is a .sys file extension, so I'd like to know if is possible to set up the compiler to generate an .exe file, so thereby a user can run it by double-clicking the executable.
I thought that perhaps, when I install some driver and the "setup" is a .exe file, in fact it isn't really the driver, it is a program that installs the driver (in .sys extension) on your computer, so the .exe file is just the installer and not the driver itself. But I am not sure if this is true.
If you could give me some information about generating a driver for Windoes, I'll be eternally grateful!
Thanks in advance!
The .exe files you're looking at are, indeed, installers. There are a number of tools available for creating installers; NSIS is one of the more popular options.
.exe marks executable files for Windows user mode. The format of user mode and kernel mode "executables" differs a lot. In particular, there is no such thing as user running the kernel executible. Kernel drivers aren't directly accessible to user mode; communication is allowed only via OS-defined interfaces, i.e. user-mode component must perform a dedicated OS call which will be routed to the kernel component by the OS. There are many more differences between kernel and user modes but this particular one explains why running kernel driver by user isn't possible (and shouldn't be).
As for your second question, yes, these .exe files are installers.

Resources