Fixing corrupted WinCE 6.0 from USB or SD card - filesystems

I have an ARM v4 device with touchscreen running Windows Embedded 6.0.
I am developing new app for it (as a replacement for the old one). Everything worked correctly but I accidentally renamed file that was intended to run at startup (if it helps it is autorun.exe in /NAND folder) and now the Win does not start.
At startup error is shown and after clicking OK the process is stuck.
I need to revert this change (rename file back) but how to do it?
I cannot connect to the device anymore with Visual Studio, Remote File/Registry Viewer or similar tool as the conman is not running and I cannot run them (because Windows is not started yet, obviously).
Is there any way how to run cmd line or some tool from SD Card or USB or Ethernet where I can execute some command to rename file back?
I do not have the OS image or the knowledge to build it from scratch, that is too complicated for me.

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.

Windows 7 Driver - Only Runs Once then Requires a Reboot

Lately, I have been playing with drivers in Windows 7. So far, I have built a driver that can talk with a user mode application.
However, I keep having a problem starting and stopping the driver.
First, I install the driver and start it, and it works just fine. I stop it, and it stops fine as well. However, when I go to start it again, it errors out with an error 2 code "Can't find the file specified".
In order to fix this, I have to uninstall the driver, then reboot. Once I have rebooted, I can install it again, and run it once, and then the process starts all over.
So my question is how do I work around this problem? I really hate having to reboot every time I rebuild and test my driver, so I was wondering if I am doing something wrong in my build and deployment process.
I am using the standard DDK command line build for the build process, and I am using an app called OSR Driver Loader to load the driver. I can, however, use the SC command line to install it as well.
I solved it. I needed to delete the symbolic link that I was creating, and to delete the Device instance.
Here is the code I out into the OnUnload function:
// this deletes the symbolic link for the driver
IoDeleteSymbolicLink(&deviceLinkUnicodeString);
// this deletes the device
IoDeleteDevice(g_RootkitDevice);
So In full, I needed to have this as my OnUnload function:
VOID OnUnload(IN PDRIVER_OBJECT DriverObject)
{
// this deletes the symbolic link for the driver
IoDeleteSymbolicLink(&deviceLinkUnicodeString);
// this deletes the device
IoDeleteDevice(g_RootkitDevice);
}

How can I create a bootable dvd with custom DOS boot script?

We have a bootable USB stick that works perfectly. It will boot, ask the user for some options, then write files to the hard drive accordingly. We did this by using rufus-2.1, throwing freedos into the USB stick, and basically hijacking autoexec.bat. Autoexec.bat now executes some separate .bat scripts based on user input.
The problem is, we now want to have an option to allow users to burn an iso to a cd or dvd. We've been trying to create an image of the USB stick and burn it to a DVD.
We found plenty of information on this subject, but nothing has worked. We started by extracting the bootimage from various bootable iso files using imgburn. None of these worked. We tried extracting the bootimage from our USB stick, and that also didn't work.
Next we tried WinImage. We extracted the boot information from boot98.exe, hijacked autoexec.exe, created a new image and injected the files. We saved the files as a bootimage and tried the above method again, which also didn't work.
Is there perhaps a more straightforward way to execute DOS .bat scripts through cd/dvd boot? We'd be open to something other than DOS as well, as long as it can write files to a hard drive based on user input through a simple boot interface.
Note: The computer itself does not contain an operating system.
Thanks.
We found a very slick setup that does what we need. Unfortunately, the CD-ROM drivers do not work properly on modern DVD drives. Using this method, it should be possible to put all the scripts directly in autoexec.bat and run commands directly on the "simulated" floppy drive. For whatever reason, we can boot from the "floppy" section of the CD-ROM, but it cannot copy files from A: to C:. I believe we are very close, but no cigar.
http://www.hiren.info/pages/bootablecd
First method that actually produced a bootable CD and allowed scripts to be run by a choice entered by the user.

ADB says 'Device Not Found' at last stage of sideloading lollipop

I'm trying to sideload Lollipop onto my Nexus 5 from the OTA zip file.
At this point, the adb recognizes the device after I plug in the USB cable, and spits out the serial number.
As I understand the instructions for sideloading, once I get to this point, I just need to reboot into recovery mode, (which works as expected) and then bypass the red exclamation point icon using "volume up and power" simultaneously. That works too.
At the point where the screen on the Nexus 5 says, "Now send the package you want to apply to the device with 'adb sideload &ltfilename&gt' I type "adb sideload + the OTA image file name", which I renamed for convenience". The file is in the platform-tools folder.
At which point the command window reports: error: device not found
So... the device is seen by the adb, but somehow is no longer found after the device reboots in recovery mode.
I've replaced all the usb drivers, enabled usb debugging and developer mode on the Nexus device. I've tried this in windows 7 and also in Linux (both from the android sdk tool kit and from an installation of Eclipse). I'm unable to get the adb to talk to the Nexus 5.
I read the android-windows usb inf file, and there is no section specifically for the Nexus 5, but I added a line under the "generic android" section with USB\VID_18D1&PID_D001 as has been suggested elsewhere for people who couldn't get the OS to see their nexus at all. My issue is not that the OS can't see it... and the adb sees it, too, until I try to sideload the OTA file in Recovery Mode.
Anyone else having this issue, or better yet... any ideas on how to solve it?
Thanks
It turns out that I had not enabled USB debugging before I tried to do this using Linux Ubuntu / Eclipse / Android SDK. So my problem was really a windows USB driver problem, I guess (though I can't be sure, since windows did see the device until I tried to transfer the file. Maybe that message was really conveying a permissions problem, too...)
I rebooted into Ubuntu and tried again and was able to transfer the update file. The only hitch I encountered at that point was to issue the sideload command as root. I didn't do that the first time I tried it, and got a message about lacking permissions.
I suspect the posted reply with a link to a universal USB inf file would have worked, but, though I'm grateful for the tip, I can't testify to that, since I managed to transfer the file without Windows.
Thanks to all who looked at this and especially to Alex P., for posting a possible solution. FW
IW, I'm glad to have finally been able to do this, but for anyone struggling to get Lollipop ahead of the OTA update... well, it's nice, but hardly worth a lot of effort.

Need to build/publish WPF app that only runs from USB Flash Drive

I am building a small WPF application that will be distributed/sold on a USB Flash drive. The application will run from the flash drive and all data entered will be stored on the flash drive.
I have built my proof of concept but my question is how do I build the install? When I try to publish the app it creates the normal setup.exe and the needed manifest files. The setup appears to check for prereqs (framework and such) then installs a startup icon. But it truly installs the program on the hard drive of the computer, which is not what I want.
Can someone point me in the right direction as to how to deploy/build/publish the application to not install but run from the USB Flash drive?
If it has to run on machines that don't already have the .NET framework (3.5 SP1 would probably be the minimum) then there is no way to avoid a big installation step that effects the target machine permanently.
Just compile and run the .exe that is created in the debug directory. I run .NET .exe from network drives all the time. If the .NET framework is not installed then it will fail.

Resources