• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Decompiling and Recompiling a .sys file

yukichigai

Diamond Member
I'm one of those accursed early adopters; I went to 64-bit Windows the minute x64 came out. So far it hasn't let me down, but every now and then I run into issues with peripherals. Usually it's obscure hardware that I don't really need to run anyway, but sometimes I'm really, really motivated to make some of this stuff work. Case in point, the latest little "toy" I bought.

Now I won't bore you with what it is, just that I really want to get it working in x64. The problem is that it relies on a .sys file that is outright incompatible (so it claims) with x64. I've managed to (I think) get it decompiled to ASM format, sort of, and it all looks fairly basic; the question is whether or not there's any way to then recompile that to a 64-bit driver. (Hell, I don't even know how to compile from ASM to a driver at all) I have no idea where to start on this. (Way to prepare me for the real world, college) Anybody else?

I moved this from HT to programming as that is the proper forum (and I think you'll get more help there as well)

bsobel - Programming Moderator
 
Originally posted by: yukichigai
I've managed to (I think) get it decompiled to ASM format, sort of, and it all looks fairly basic; the question is whether or not there's any way to then recompile that to a 64-bit driver. (Hell, I don't even know how to compile from ASM to a driver at all) I have no idea where to start on this. (Way to prepare me for the real world, college) Anybody else?

'looks fairly basic' - yeah one line looks easy to understand until you start putting them together into generically labeled functions and variables. How many lines of ASM did it decompile to? I don't think it's possible to rewrite portions of ASM that big unless you had the source with all the comments and real labels. Actually its possible, but by that time I bet they will have come out with a 64 bit driver ( probably years ).

The only example I've seen of being able to make your own driver is with Microchips' generic USB driver -> they give you all the source ( in C ) and documentation. You get a sample driver and application and you can modify it to your needs ( I haven't really messed around with the PC side of the software ).

 
What sort of hardware is it ?
I've had some luck with network cards and asm.
I tracked down the chipset the network card was using and was able to make xp 64 bit see the card as that of another manufacturer by hacking a driver that worked in x64.

If you can list what the hardware is, chips, etc might be able to suggest more.
 
Originally posted by: PottedMeat
'looks fairly basic' - yeah one line looks easy to understand until you start putting them together into generically labeled functions and variables. How many lines of ASM did it decompile to? I don't think it's possible to rewrite portions of ASM that big unless you had the source with all the comments and real labels. Actually its possible, but by that time I bet they will have come out with a 64 bit driver ( probably years ).

The only example I've seen of being able to make your own driver is with Microchips' generic USB driver -> they give you all the source ( in C ) and documentation. You get a sample driver and application and you can modify it to your needs ( I haven't really messed around with the PC side of the software ).
I'm hoping for a way I can compile a sys file directly from asm code, rather than having to convert it to C. I know for a fact that x64 assembler has access to the same registers that 32-bit windows assembler does, just with the addition of a bunch of 64-bit registers as well. The main problem is that I don't even know how to get from asm to a working sys file in 32-bit, much less 64-bit.

Also, it's about 180k of code. Not something I could really convert by hand to C anyway.

To answer Modelworks' question, it's a driver for a proprietalicious "productivity toy" I bought recently. Multifunction, including storing contacts and the like.
 
Originally posted by: yukichigai
Originally posted by: PottedMeat
'looks fairly basic' - yeah one line looks easy to understand until you start putting them together into generically labeled functions and variables. How many lines of ASM did it decompile to? I don't think it's possible to rewrite portions of ASM that big unless you had the source with all the comments and real labels. Actually its possible, but by that time I bet they will have come out with a 64 bit driver ( probably years ).

The only example I've seen of being able to make your own driver is with Microchips' generic USB driver -> they give you all the source ( in C ) and documentation. You get a sample driver and application and you can modify it to your needs ( I haven't really messed around with the PC side of the software ).
I'm hoping for a way I can compile a sys file directly from asm code, rather than having to convert it to C. I know for a fact that x64 assembler has access to the same registers that 32-bit windows assembler does, just with the addition of a bunch of 64-bit registers as well. The main problem is that I don't even know how to get from asm to a working sys file in 32-bit, much less 64-bit.

Also, it's about 180k of code. Not something I could really convert by hand to C anyway.

To answer Modelworks' question, it's a driver for a proprietalicious "productivity toy" I bought recently. Multifunction, including storing contacts and the like.

180K of ASM? You think this looks "basic"? I think you are in over your head here, no offense.
 
Unless you know the functions of the hardware (packet formats, command ids, etc), can get them from the vendor, or can deduce them from reading the ASM it's not worth the effort. Building drivers is more about knowing the vendor's hardware interface than anything else.

Cross assembling something that isn't compatible in the first place most likely won't work, as addressing, virtual memory space, and all sorts of stuff is going to be completely messed up. What about the .sys file is not compatible?
 
What does the Vendor of the "toy' state from their tech support.

Or are they no longer in business?
 
I'm hoping for a way I can compile a sys file directly from asm code, rather than having to convert it to C. I know for a fact that x64 assembler has access to the same registers that 32-bit windows assembler does, just with the addition of a bunch of 64-bit registers as well. The main problem is that I don't even know how to get from asm to a working sys file in 32-bit, much less 64-bit.

You'll have much better luck looking for developer docs on how to interface with the hardware and writing a new driver from scratch. If it's a USB device you might be able to use a USB protocol sniffer and work from that.
 
Back
Top