mtkennerly / shawl

Windows service wrapper for arbitrary commands
MIT License
518 stars 15 forks source link

Windows xp support? #7

Closed federicoemartinez closed 4 years ago

federicoemartinez commented 4 years ago

Hi! At work, I need to be able to deploy some apps in legacy computers that still run XP and run them as services. I have tried the binary from the release page and it did not work. I tried to compile it myself using some flags to choose the platform with no luck (disclaimer: i'm really a newbie with rust).

Do you think this is even possible?

mtkennerly commented 4 years ago

Oof, I hope your job decides to upgrade those sometime in the next century 🙃 I don't directly support Windows XP in my projects, but it may be possible. What errors do you get when you run the 32-bit version of Shawl on XP?

Rust's supported platform list says that the i686-pc-windows-msvc target has tier 3 support for 32-bit Windows XP, and that's the target I use for the 32-bit releases. Since it's tier 3, though, it may not be tested regularly, but at least it theoretically has been done before. I would suggest starting with a really simple hello world project (cargo new xp-test) and see if that will run at all on XP. I think you'd probably compile it on a non-XP computer and then copy the .exe over to the XP system. If it works, then you could try tweaking the Shawl code or which dependencies it uses to work around the issues you run into.

federicoemartinez commented 4 years ago

The company is ok, the problems are the banks that are its customers :man_facepalming: So, when I try the one from releases, what I get is: shawl.exe is not a valid Win32 application

I tried myself building it, changed some flags base on what I found on stack overflow for instance:

[build]
rustflags = [
  "-C", "link-arg=/subsystem:console,5.01",
  "-C", "target-feature=+crt-static",
  "-C", "opt-level=s"
]

[rust]
backtrace = false

And what I get when I run that binary is: The procedure entry point GetFileInformationByHandleEx could not be located in the dynamic link library KERNEL32.dll.

Thanks for you time. I just tried luck, you might had said "Oh yes, I have this floppy disk with the XP version" haha.

I proceed to close this because it is not a problem with shawl.

Thanks again!

mtkennerly commented 4 years ago

Sure, no problem!

I wonder if that GetFile... error is because of winapi crate features that don't exist on XP. It may be worth trying to change this line in Cargo.toml:

winapi = { version = "0.3.8", features = ["wincon"] }

to this:

winapi = { version = "0.3.8", features = ["wincon"], default-features = false }

You might need to enable a few other winapi features (full list). Shawl uses these modules:

winapi::shared::winerror
winapi::um::consoleapi
winapi::um::errhandlingapi
winapi::um::wincon

Beyond that, I'm not sure what else you could try.